]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
lookup "secondary" directly, dont use eval()
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 22 Oct 2024 18:33:23 +0000 (14:33 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 23 Oct 2024 15:37:56 +0000 (11:37 -0400)
commitffebb07b304197997455ee0b5643c19eaf0d46e4
treed09263bcf2b2714a3b2d17db409ac12583430094
parentaaddd7c8403e9ca2f77113467b5e2ae279a542c4
lookup "secondary" directly, dont use eval()

The :paramref:`_orm.relationship.secondary` parameter no longer uses Python
``eval()`` to evaluate the given string.   This parameter when passed a
string should resolve to a table name that's present in the local
:class:`.MetaData` collection only, and never needs to be any kind of
Python expression otherwise.  To use a real deferred callable based on a
name that may not be locally present yet, use a lambda instead.

Fixes: #10564
Change-Id: I9bb5a2ea17c7efac88df1470d109970cfb4c4874
doc/build/changelog/unreleased_21/10564.rst [new file with mode: 0644]
lib/sqlalchemy/orm/_orm_constructors.py
lib/sqlalchemy/orm/clsregistry.py
test/orm/declarative/test_basic.py
test/orm/test_query.py
test/orm/test_relationships.py