]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Fix the code examples and the grammatic in `declarative_tables.rst` (#12721) main
authorRoman Mashevskyi <romanmashevskyi@proton.me>
Mon, 7 Jul 2025 20:23:43 +0000 (23:23 +0300)
committerGitHub <noreply@github.com>
Mon, 7 Jul 2025 20:23:43 +0000 (22:23 +0200)
* Fix the code example in `declarative_tables.rst`

Add an import of a `Optional` class from the `typing` library in the
code example of the "Union types inside the Type Map" chapter.

* Fix the code example in `declarative_tables.rst`

Replace the import of the `deferred` function to `column_property` from
the `sqlalchemy.orm` package in first code example of the "Applying
Load, Persistence and Mapping Options for Imperative Table Columns"
chapter.

* Fix the grammatic in `declarative_tables.rst`

Remove the unnecessary article in the second paragraph of the
"Mapping to an Explicit Set of Primary Key Columns" chapter in
`declarative_tables.rst`.

doc/build/orm/declarative_tables.rst

index 5eb9578568de2a50a7548e85cf5f739796e1e19f..ebf185d53755aef6d537299fcf39f5e5b599ca3b 100644 (file)
@@ -709,7 +709,7 @@ SQLAlchemy supports mapping union types inside the ``type_annotation_map`` to
 allow mapping database types that can support multiple Python types, such as
 :class:`_types.JSON` or :class:`_postgresql.JSONB`::
 
-    from typing import Union
+    from typing import Union, Optional
     from sqlalchemy import JSON
     from sqlalchemy.dialects import postgresql
     from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
@@ -1720,7 +1720,7 @@ associate additional parameters with the column.   Options include:
   collection when inspecting the history of the attribute.   This may incur
   additional SQL statements::
 
-    from sqlalchemy.orm import deferred
+    from sqlalchemy.orm import column_property
 
     user_table = Table(
         "user",
@@ -1958,7 +1958,7 @@ that selectable.   This is so that when an ORM object is loaded or persisted,
 it can be placed in the :term:`identity map` with an appropriate
 :term:`identity key`.
 
-In those cases where the a reflected table to be mapped does not include
+In those cases where a reflected table to be mapped does not include
 a primary key constraint, as well as in the general case for
 :ref:`mapping against arbitrary selectables <orm_mapping_arbitrary_subqueries>`
 where primary key columns might not be present, the