Skip to content

Commit

Permalink
docs: fix typos in sqlalchemy examples (#3798)
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn authored Oct 14, 2024
1 parent ad592f6 commit 6493543
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
10 changes: 5 additions & 5 deletions docs/examples/contrib/sqlalchemy/sqlalchemy_async_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
10 changes: 5 additions & 5 deletions docs/examples/contrib/sqlalchemy/sqlalchemy_sync_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
Expand Down

0 comments on commit 6493543

Please sign in to comment.