]> 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:47 +0000 (19:37 -0400)
commit53591fc18dbf879c5fbda04f675b6341056f9781
treea57ff181236456fd4db1db1e323709f5a7b1e272
parent0b8b4bcdd5fea10fdf4fc9c89db809381c1b8fe3
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
(cherry picked from commit 17e31604ae13ebd58b148a4319cfed09e5448ee2)
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