From 31c85f4a152a80fcd5ae2a0a154938f837a5e2d4 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Fri, 22 Nov 2024 17:15:52 -0800 Subject: [PATCH] Remove obsolete SQLAlchemy future flags Importing from `sqlalchemy.future` and passing `future=True` when creating sessions is no longer required since we require SQLAlchemy 2.0 or later. --- docs/user-guide/database/session.rst | 2 +- safir/src/safir/database/_connection.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/user-guide/database/session.rst b/docs/user-guide/database/session.rst index 13a9766f..9d2a3284 100644 --- a/docs/user-guide/database/session.rst +++ b/docs/user-guide/database/session.rst @@ -46,7 +46,7 @@ For example: .. code-block:: python import structlog - from sqlalchemy.future import select + from sqlalchemy import select from .schema import User diff --git a/safir/src/safir/database/_connection.py b/safir/src/safir/database/_connection.py index df4a8bda..13e796fd 100644 --- a/safir/src/safir/database/_connection.py +++ b/safir/src/safir/database/_connection.py @@ -105,11 +105,9 @@ def create_database_engine( """ url = build_database_url(url, password) if isolation_level: - return create_async_engine( - url, future=True, isolation_level=isolation_level - ) + return create_async_engine(url, isolation_level=isolation_level) else: - return create_async_engine(url, future=True) + return create_async_engine(url) async def create_async_session(