chore: improve db session access (#3138)

* chore: improve db session access

* chore: improve db session access

* fix

* [autofix.ci] apply automated fixes

* Refactor session management in test_sqlite_pragmas to use with_session method

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
Nicolò Boschi 2024-08-30 23:03:29 +02:00 • committed by GitHub
commit 1c87a804bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 21 additions and 35 deletions

View file

@ -407,7 +407,7 @@ def test_migrate_transactions_no_duckdb(client: TestClient):
def test_sqlite_pragmas():
db_service = get_db_service()
with db_service as session:
with db_service.with_session() as session:
from sqlalchemy import text
assert "wal" == session.execute(text("PRAGMA journal_mode;")).fetchone()[0]