]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Add __clause_element__ to ColumnProperty
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 22 Nov 2018 15:39:29 +0000 (10:39 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 28 Nov 2018 01:12:16 +0000 (20:12 -0500)
commit835444be72bb595b1ed3ee5458a86202813412a6
tree4a28b458292860c8739fb481d4c50cd2cf04328d
parentf39a6216eed6939c29bbea554f8fb84238c84d10
Add __clause_element__ to ColumnProperty

Added a ``__clause_element__()`` method to :class:`.ColumnProperty` which
can allow the usage of a not-fully-declared column or deferred attribute in
a declarative mapped class slightly more friendly when it's used in a
constraint or other column-oriented scenario within the class declaration,
though this still can't work in open-ended expressions; prefer to call the
:attr:`.ColumnProperty.expression` attribute if receiving ``TypeError``.

Fixes: #4372
Change-Id: I5d3d1adb9c77de0566298bc2c46e9001d314b0c7
doc/build/changelog/unreleased_13/4372.rst [new file with mode: 0644]
doc/build/errors.rst
lib/sqlalchemy/orm/properties.py
test/ext/declarative/test_basic.py