diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-01-13 17:24:14 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-01-14 16:45:01 -0500 |
| commit | e07130c597422d5f9a5d734e1411d8fef0c2deff (patch) | |
| tree | e3367d1d9c454998c19ae32c6c013e1fb1ff1321 /lib/sqlalchemy/sql | |
| parent | 0c5faf37c2c8779be4e587528a56f19b455a3576 (diff) | |
| download | sqlalchemy-e07130c597422d5f9a5d734e1411d8fef0c2deff.tar.gz | |
implement polymorphic_abstract=True feature
Added a new parameter to :class:`_orm.Mapper` called
:paramref:`_orm.Mapper.polymorphic_abstract`. The purpose of this directive
is so that the ORM will not consider the class to be instantiated or loaded
directly, only subclasses. The actual effect is that the
:class:`_orm.Mapper` will prevent direct instantiation of instances
of the class and will expect that the class does not have a distinct
polymorphic identity configured.
In practice, the class that is mapped with
:paramref:`_orm.Mapper.polymorphic_abstract` can be used as the target of a
:func:`_orm.relationship` as well as be used in queries; subclasses must of
course include polymorphic identities in their mappings.
The new parameter is automatically applied to classes that subclass
the :class:`.AbstractConcreteBase` class, as this class is not intended
to be instantiated.
Additionally, updated some areas of the single table inheritance
documentation to include mapped_column(nullable=False) for all
subclass-only columns; the mappings as given didn't work as the
columns were no longer nullable using Annotated Declarative Table
style.
Fixes: #9060
Change-Id: Ief0278e3945a33a6ff38ac14d39c38ce24910d7f
Diffstat (limited to 'lib/sqlalchemy/sql')
0 files changed, 0 insertions, 0 deletions
