From 75163df8ef4896589d00b682813f01e1a436afcb Mon Sep 17 00:00:00 2001 From: Roman Mashevskyi Date: Mon, 7 Jul 2025 23:23:43 +0300 Subject: [PATCH] Fix the code examples and the grammatic in `declarative_tables.rst` (#12721) * 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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/build/orm/declarative_tables.rst b/doc/build/orm/declarative_tables.rst index 5eb9578568..ebf185d537 100644 --- a/doc/build/orm/declarative_tables.rst +++ b/doc/build/orm/declarative_tables.rst @@ -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 ` where primary key columns might not be present, the -- 2.39.5