]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Use dot-separated name resolution for relationship target
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 7 Apr 2020 21:37:14 +0000 (17:37 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 7 Apr 2020 23:37:39 +0000 (19:37 -0400)
commit17e31604ae13ebd58b148a4319cfed09e5448ee2
tree52952e0f02676562f23f990bfaab2164d48f544d
parent5150ef4ed166042b4a1f4a77b5a0af609b5fc660
Use dot-separated name resolution for relationship target

The string argument accepted as the first positional argument by the
:func:`.relationship` function when using the Declarative API is no longer
interpreted using the Python ``eval()`` function; instead, the name is dot
separated and the names are looked up directly in the name resolution
dictionary without treating the value as a Python expression.  However,
passing a string argument to the other :func:`.relationship` parameters
that necessarily must accept Python expressions will still use ``eval()``;
the documentation has been clarified to ensure that there is no ambiguity
that this is in use.

Fixes: #5238
Change-Id: Id802f403190adfab0ca034afe2214ba10fd9cfbb
doc/build/changelog/unreleased_13/5238.rst [new file with mode: 0644]
doc/build/orm/basic_relationships.rst
doc/build/orm/extensions/declarative/relationships.rst
doc/build/orm/join_conditions.rst
lib/sqlalchemy/ext/declarative/clsregistry.py
lib/sqlalchemy/orm/relationships.py
test/ext/declarative/test_clsregistry.py