]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
derive optional for nullable from interior of pep-593 types
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 29 Jan 2023 15:10:30 +0000 (10:10 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 30 Jan 2023 03:19:29 +0000 (22:19 -0500)
commit8f441c7a7b021205a962689ab7d0d5c19c073242
tree89f65162de92a4d435826fe671e5d1ff35416bdb
parentb99b0c522ddb94468da27867ddfa1f7e2633c920
derive optional for nullable from interior of pep-593 types

Improved the ruleset used to interpret :pep:`593` ``Annotated`` types when
used with Annotated Declarative mapping, the inner type will be checked for
"Optional" in all cases which will be added to the criteria by which the
column is set as "nullable" or not; if the type within the ``Annotated``
container is optional (or unioned with ``None``), the column will be
considered nullable if there are no explicit
:paramref:`_orm.mapped_column.nullable` parameters overriding it.

Fixes: #9177
Change-Id: I4b1240da198e35b93006fd90f6cb259c9d2cbf30
doc/build/changelog/unreleased_20/9177.rst [new file with mode: 0644]
lib/sqlalchemy/orm/properties.py
test/orm/declarative/test_tm_future_annotations_sync.py
test/orm/declarative/test_typed_mapping.py