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] diff --git a/docs/usage/caching.rst b/docs/usage/caching.rst index 3eaf68cb8e..46f9254470 100644 --- a/docs/usage/caching.rst +++ b/docs/usage/caching.rst @@ -35,7 +35,7 @@ sentinel instead: :language: python :caption: Caching the response indefinitely by setting the :paramref:`~litestar.handlers.HTTPRouteHandler.cache` parameter to :class:`~litestar.config.response_cache.CACHE_FOREVER`. - :lines: 1, 3, 14-18 + :lines: 1-3, 14-18 :emphasize-lines: 5 Configuration diff --git a/docs/usage/databases/sqlalchemy/models_and_repository.rst b/docs/usage/databases/sqlalchemy/models_and_repository.rst index d5dc0f1b77..c74604b1ef 100644 --- a/docs/usage/databases/sqlalchemy/models_and_repository.rst +++ b/docs/usage/databases/sqlalchemy/models_and_repository.rst @@ -36,7 +36,7 @@ implementations: * :class:`UUIDAuditBase ` Both include a ``UUID`` based primary key -and ``UUIDAuditBase`` includes an ``updated_at`` and ``created_at`` timestamp column. +and ``UUIDAuditBase`` includes ``updated_at`` and ``created_at`` timestamp columns. The ``UUID`` will be a native ``UUID``/``GUID`` type on databases that support it such as Postgres. For other engines without a native UUID data type, the UUID is stored as a 16-byte ``BYTES`` or ``RAW`` field. @@ -45,7 +45,7 @@ a native UUID data type, the UUID is stored as a 16-byte ``BYTES`` or ``RAW`` fi * :class:`BigIntAuditBase ` Both include a ``BigInteger`` based primary key -and ``BigIntAuditBase`` includes an ``updated_at`` and ``created_at`` timestamp column. +and ``BigIntAuditBase`` includes ``updated_at`` and ``created_at`` timestamp columns. Models using these bases also include the following enhancements: