From 98c88e13dfbbd672c9eebd2fbe5fd245fd037e90 Mon Sep 17 00:00:00 2001 From: Luis San Pablo Date: Fri, 29 Sep 2023 21:40:35 -0500 Subject: [PATCH] docs: remove references to `SQLAlchemyAsyncConfig.create_engine` (#2380) docs: remove references to Co-authored-by: Peter Schutt --- docs/examples/contrib/sqlalchemy/sqlalchemy_async_repository.py | 2 +- .../contrib/sqlalchemy/sqlalchemy_declarative_models.py | 2 +- .../contrib/sqlalchemy/sqlalchemy_repository_extension.py | 2 +- docs/examples/contrib/sqlalchemy/sqlalchemy_sync_repository.py | 2 +- .../pagination/using_offset_pagination_with_sqlalchemy.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) 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)