From 64935439ad37081f8b60f11b7462f880f3c55a0b Mon Sep 17 00:00:00 2001 From: sobolevn Date: Mon, 14 Oct 2024 23:23:44 +0300 Subject: [PATCH] docs: fix typos in `sqlalchemy` examples (#3798) --- .../contrib/sqlalchemy/sqlalchemy_async_repository.py | 10 +++++----- .../sqlalchemy/sqlalchemy_declarative_models.py | 6 +++--- .../sqlalchemy/sqlalchemy_repository_extension.py | 6 +++--- .../contrib/sqlalchemy/sqlalchemy_sync_repository.py | 10 +++++----- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/examples/contrib/sqlalchemy/sqlalchemy_async_repository.py b/docs/examples/contrib/sqlalchemy/sqlalchemy_async_repository.py index f8255a17bf..615b5aa8e6 100644 --- a/docs/examples/contrib/sqlalchemy/sqlalchemy_async_repository.py +++ b/docs/examples/contrib/sqlalchemy/sqlalchemy_async_repository.py @@ -34,8 +34,8 @@ class BaseModel(_BaseModel): model_config = {"from_attributes": True} -# the SQLAlchemy base includes a declarative model for you to use in your models. -# The `Base` class includes a `UUID` based primary key (`id`) +# The SQLAlchemy base includes a declarative model for you to use in your models. +# The `UUIDBase` class includes a `UUID` based primary key (`id`) class AuthorModel(base.UUIDBase): # we can optionally provide the table name instead of auto-generating it __tablename__ = "author" # type: ignore[assignment] @@ -44,9 +44,9 @@ class AuthorModel(base.UUIDBase): books: Mapped[list[BookModel]] = relationship(back_populates="author", lazy="noload") -# The `AuditBase` class includes the same UUID` based primary key (`id`) and 2 -# additional columns: `created` and `updated`. `created` is a timestamp of when the -# record created, and `updated` is the last time the record was modified. +# The `UUIDAuditBase` class includes the same UUID` based primary key (`id`) and 2 +# additional columns: `created_at` and `updated_at`. `created_at` is a timestamp of when the +# record created, and `updated_at` is the last time the record was modified. class BookModel(base.UUIDAuditBase): __tablename__ = "book" # type: ignore[assignment] title: Mapped[str] diff --git a/docs/examples/contrib/sqlalchemy/sqlalchemy_declarative_models.py b/docs/examples/contrib/sqlalchemy/sqlalchemy_declarative_models.py index cae8ff5ab1..2a4f7e302c 100644 --- a/docs/examples/contrib/sqlalchemy/sqlalchemy_declarative_models.py +++ b/docs/examples/contrib/sqlalchemy/sqlalchemy_declarative_models.py @@ -14,15 +14,15 @@ from litestar.contrib.sqlalchemy.plugins import AsyncSessionConfig, SQLAlchemyAsyncConfig, SQLAlchemyPlugin -# the SQLAlchemy base includes a declarative model for you to use in your models. -# The `Base` class includes a `UUID` based primary key (`id`) +# The SQLAlchemy base includes a declarative model for you to use in your models. +# The `UUIDBase` class includes a `UUID` based primary key (`id`) class Author(UUIDBase): name: Mapped[str] dob: Mapped[date] books: Mapped[List[Book]] = relationship(back_populates="author", lazy="selectin") -# The `AuditBase` class includes the same UUID` based primary key (`id`) and 2 +# The `UUIDAuditBase` class includes the same UUID` based primary key (`id`) and 2 # additional columns: `created_at` and `updated_at`. `created_at` is a timestamp of when the # record created, and `updated_at` is the last time the record was modified. class Book(UUIDAuditBase): diff --git a/docs/examples/contrib/sqlalchemy/sqlalchemy_repository_extension.py b/docs/examples/contrib/sqlalchemy/sqlalchemy_repository_extension.py index f864bbcdd7..258fae4377 100644 --- a/docs/examples/contrib/sqlalchemy/sqlalchemy_repository_extension.py +++ b/docs/examples/contrib/sqlalchemy/sqlalchemy_repository_extension.py @@ -96,9 +96,9 @@ async def _is_slug_unique( return await self.get_one_or_none(slug=slug) is None -# The `AuditBase` class includes the same UUID` based primary key (`id`) and 2 -# additional columns: `created` and `updated`. `created` is a timestamp of when the -# record created, and `updated` is the last time the record was modified. +# The `UUIDAuditBase` class includes the same UUID` based primary key (`id`) and 2 +# additional columns: `created_at` and `updated_at`. `created_at` is a timestamp of when the +# record created, and `updated_at` is the last time the record was modified. class BlogPost(UUIDAuditBase, SlugKey): title: Mapped[str] content: Mapped[str] diff --git a/docs/examples/contrib/sqlalchemy/sqlalchemy_sync_repository.py b/docs/examples/contrib/sqlalchemy/sqlalchemy_sync_repository.py index 67e2840761..fc22e451eb 100644 --- a/docs/examples/contrib/sqlalchemy/sqlalchemy_sync_repository.py +++ b/docs/examples/contrib/sqlalchemy/sqlalchemy_sync_repository.py @@ -30,8 +30,8 @@ class BaseModel(_BaseModel): model_config = {"from_attributes": True} -# the SQLAlchemy base includes a declarative model for you to use in your models. -# The `Base` class includes a `UUID` based primary key (`id`) +# The SQLAlchemy base includes a declarative model for you to use in your models. +# The `UUIDBase` class includes a `UUID` based primary key (`id`) class AuthorModel(UUIDBase): # we can optionally provide the table name instead of auto-generating it __tablename__ = "author" # type: ignore[assignment] @@ -40,9 +40,9 @@ class AuthorModel(UUIDBase): books: Mapped[list[BookModel]] = relationship(back_populates="author", lazy="noload") -# The `AuditBase` class includes the same UUID` based primary key (`id`) and 2 -# additional columns: `created` and `updated`. `created` is a timestamp of when the -# record created, and `updated` is the last time the record was modified. +# The `UUIDAuditBase` class includes the same UUID` based primary key (`id`) and 2 +# additional columns: `created_at` and `updated_at`. `created_at` is a timestamp of when the +# record created, and `updated_at` is the last time the record was modified. class BookModel(UUIDAuditBase): __tablename__ = "book" # type: ignore[assignment] title: Mapped[str]