Rename Trade.session to Trade._session

This commit is contained in:
Matthias
2021-04-05 08:46:12 +02:00
parent ea0b47a7f9
commit 7132aefd60
2 changed files with 6 additions and 6 deletions

View File

@@ -59,10 +59,10 @@ def init_db(db_url: str, clean_open_orders: bool = False) -> None:
# https://docs.sqlalchemy.org/en/13/orm/contextual.html#thread-local-scope
# Scoped sessions proxy requests to the appropriate thread-local session.
# We should use the scoped_session object - not a seperately initialized version
Trade.session = scoped_session(sessionmaker(bind=engine, autoflush=True, autocommit=True))
Trade.query = Trade.session.query_property()
Order.query = Trade.session.query_property()
PairLock.query = Trade.session.query_property()
Trade._session = scoped_session(sessionmaker(bind=engine, autoflush=True, autocommit=True))
Trade.query = Trade._session.query_property()
Order.query = Trade._session.query_property()
PairLock.query = Trade._session.query_property()
previous_tables = inspect(engine).get_table_names()
_DECL_BASE.metadata.create_all(engine)