]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Check for __clause_element__() in ORM insert/update
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 5 Oct 2016 14:57:30 +0000 (10:57 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 5 Oct 2016 16:11:53 +0000 (12:11 -0400)
commit09b685b24b19636e11169c181b45333f9739ca35
tree12f176c23ffb9f9f9de75e4fdb07ec8eed5611cb
parent20384e894577bc6cd7e686a71e6e859207565d00
Check for __clause_element__() in ORM insert/update

ORM attributes can now be assigned any object that is has a
``__clause_element__()`` attribute, which will result in inline
SQL the way any :class:`.ClauseElement` class does.  This covers other
mapped attributes not otherwise transformed by further expression
constructs.

As part of this, it was considered that we could add
__clause_element__() to ClauseElement, however this causes endless loops
in a "while" pattern and this pattern has been identified in third
party libraries.  Add a test to ensure we never make that change.

Change-Id: I9e15b3f1c4883fd3909acbf7dc81d034c6e3ce1d
Fixes: #3802
doc/build/changelog/changelog_11.rst
doc/build/changelog/migration_11.rst
lib/sqlalchemy/ext/hybrid.py
lib/sqlalchemy/orm/persistence.py
test/orm/test_unitofwork.py
test/sql/test_inspect.py