Ustvari engine samo 1x
parent
7057e3c753
commit
a8b42f0c90
|
@ -49,6 +49,7 @@ engine = create_engine(CONFIG['DB_CONNECTION'])
|
||||||
Base.metadata.create_all(engine)
|
Base.metadata.create_all(engine)
|
||||||
|
|
||||||
def get_session():
|
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)
|
dbsessionmaker = sessionmaker(bind=engine)
|
||||||
return dbsessionmaker()
|
return dbsessionmaker()
|
||||||
|
|
Loading…
Reference in New Issue