]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
accommodate all mapped_column() parameters in Annotated transfer
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 19 Sep 2023 21:57:50 +0000 (17:57 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 20 Sep 2023 22:14:47 +0000 (18:14 -0400)
commit4c6429d068de811b4a5e50fb3175175ac8ea0360
treea59947fb8164e6fa260fac2efbe684f24679b201
parent5b60145d31f3332fc843698461e058ebbafab38c
accommodate all mapped_column() parameters in Annotated transfer

Fixed a wide range of :func:`_orm.mapped_column` parameters that were not
being transferred when using the :func:`_orm.mapped_column` object inside
of a pep-593 ``Annotated`` object, including
:paramref:`_orm.mapped_column.sort_order`,
:paramref:`_orm.mapped_column.deferred`,
:paramref:`_orm.mapped_column.autoincrement`,
:paramref:`_orm.mapped_column.system`, :paramref:`_orm.mapped_column.info`
etc.

Additionally, it remains not supported to have dataclass arguments, such as
:paramref:`_orm.mapped_column.kw_only`,
:paramref:`_orm.mapped_column.default_factory` etc. indicated within the
:func:`_orm.mapped_column` received by ``Annotated``, as this is not
supported with pep-681 Dataclass Transforms.  A warning is now emitted when
these parameters are used within ``Annotated`` in this way (and they
continue to be ignored).

Fixes: #10369
Fixes: #10046
Change-Id: Ibcfb287cba0e764db0ae15fab8049bbb9f94dd1b
doc/build/changelog/unreleased_20/10369.rst [new file with mode: 0644]
lib/sqlalchemy/orm/_orm_constructors.py
lib/sqlalchemy/orm/properties.py
lib/sqlalchemy/sql/schema.py
test/orm/declarative/test_tm_future_annotations_sync.py
test/orm/declarative/test_typed_mapping.py
test/sql/test_metadata.py