mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 14:35:27 +00:00
python: Reformat with Black, except quotes.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
5028c081cb
commit
11741543da
@@ -26,17 +26,24 @@ class NonClosingPool(sqlalchemy.pool.NullPool):
|
||||
_dispatch=self.dispatch, # type: ignore[attr-defined] # implementation detail
|
||||
)
|
||||
|
||||
|
||||
sqlalchemy_engine: Optional[Any] = None
|
||||
|
||||
|
||||
def get_sqlalchemy_connection() -> sqlalchemy.engine.base.Connection:
|
||||
global sqlalchemy_engine
|
||||
if sqlalchemy_engine is None:
|
||||
|
||||
def get_dj_conn() -> TimeTrackingConnection:
|
||||
connection.ensure_connection()
|
||||
return connection.connection
|
||||
sqlalchemy_engine = sqlalchemy.create_engine('postgresql://',
|
||||
creator=get_dj_conn,
|
||||
poolclass=NonClosingPool,
|
||||
pool_reset_on_return=False)
|
||||
|
||||
sqlalchemy_engine = sqlalchemy.create_engine(
|
||||
'postgresql://',
|
||||
creator=get_dj_conn,
|
||||
poolclass=NonClosingPool,
|
||||
pool_reset_on_return=False,
|
||||
)
|
||||
sa_connection = sqlalchemy_engine.connect()
|
||||
sa_connection.execution_options(autocommit=False)
|
||||
return sa_connection
|
||||
|
||||
Reference in New Issue
Block a user