Ustvari engine samo 1x

master
Jurij Podgoršek 2022-09-07 23:22:11 +02:00
parent 7057e3c753
commit a8b42f0c90
1 changed files with 2 additions and 1 deletions

View File

@ -49,6 +49,7 @@ engine = create_engine(CONFIG['DB_CONNECTION'])
Base.metadata.create_all(engine)
def get_session():
engine = create_engine(CONFIG['DB_CONNECTION'])
# Engine je samo enkrat treba inicializirat, se mi zdi.
# engine = create_engine(CONFIG['DB_CONNECTION'])
dbsessionmaker = sessionmaker(bind=engine)
return dbsessionmaker()