diff --git a/docs/examples/contrib/sqlalchemy/sqlalchemy_async_repository.py b/docs/examples/contrib/sqlalchemy/sqlalchemy_async_repository.py index 04d9ccbb1b..69cc19242d 100644 --- a/docs/examples/contrib/sqlalchemy/sqlalchemy_async_repository.py +++ b/docs/examples/contrib/sqlalchemy/sqlalchemy_async_repository.py @@ -204,7 +204,7 @@ async def delete_author( async def on_startup() -> None: """Initializes the database.""" - async with sqlalchemy_config.create_engine().begin() as conn: + async with sqlalchemy_config.get_engine().begin() as conn: await conn.run_sync(UUIDBase.metadata.create_all) diff --git a/docs/examples/contrib/sqlalchemy/sqlalchemy_declarative_models.py b/docs/examples/contrib/sqlalchemy/sqlalchemy_declarative_models.py index 5cb06fa0db..984181dc3a 100644 --- a/docs/examples/contrib/sqlalchemy/sqlalchemy_declarative_models.py +++ b/docs/examples/contrib/sqlalchemy/sqlalchemy_declarative_models.py @@ -39,7 +39,7 @@ class Book(UUIDAuditBase): async def on_startup() -> None: """Initializes the database.""" - async with sqlalchemy_config.create_engine().begin() as conn: + async with sqlalchemy_config.get_engine().begin() as conn: await conn.run_sync(UUIDBase.metadata.create_all) diff --git a/docs/examples/contrib/sqlalchemy/sqlalchemy_repository_extension.py b/docs/examples/contrib/sqlalchemy/sqlalchemy_repository_extension.py index 27829026bc..4449d2cbd3 100644 --- a/docs/examples/contrib/sqlalchemy/sqlalchemy_repository_extension.py +++ b/docs/examples/contrib/sqlalchemy/sqlalchemy_repository_extension.py @@ -141,7 +141,7 @@ async def provide_blog_post_repo(db_session: AsyncSession) -> BlogPostRepository async def on_startup() -> None: """Initializes the database.""" - async with sqlalchemy_config.create_engine().begin() as conn: + async with sqlalchemy_config.get_engine().begin() as conn: await conn.run_sync(UUIDAuditBase.metadata.create_all) diff --git a/docs/examples/contrib/sqlalchemy/sqlalchemy_sync_repository.py b/docs/examples/contrib/sqlalchemy/sqlalchemy_sync_repository.py index 8462fdc61d..ff6d664f69 100644 --- a/docs/examples/contrib/sqlalchemy/sqlalchemy_sync_repository.py +++ b/docs/examples/contrib/sqlalchemy/sqlalchemy_sync_repository.py @@ -205,7 +205,7 @@ def delete_author( def on_startup() -> None: """Initializes the database.""" - with sqlalchemy_config.create_engine().begin() as conn: + with sqlalchemy_config.get_engine().begin() as conn: UUIDBase.metadata.create_all(conn) diff --git a/docs/examples/pagination/using_offset_pagination_with_sqlalchemy.py b/docs/examples/pagination/using_offset_pagination_with_sqlalchemy.py index 80a996b153..98ca36fc04 100644 --- a/docs/examples/pagination/using_offset_pagination_with_sqlalchemy.py +++ b/docs/examples/pagination/using_offset_pagination_with_sqlalchemy.py @@ -45,7 +45,7 @@ async def people_handler(paginator: PersonOffsetPaginator, limit: int, offset: i async def on_startup() -> None: """Initializes the database.""" - async with sqlalchemy_config.create_engine().begin() as conn: + async with sqlalchemy_config.get_engine().begin() as conn: await conn.run_sync(UUIDBase.metadata.create_all)