]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
warn on failed aliased
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 8 Aug 2025 16:17:16 +0000 (12:17 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 31 Aug 2025 20:32:58 +0000 (16:32 -0400)
commit0439f17fd5a2fec48e0c3f4f4e5d397c6eff1edf
treebce99e598cc46cf6256ec7290cb53c47494d1b7f
parente96bf8608ed2862f538ac0873303c91ed3a7260c
warn on failed aliased

The :func:`_orm.aliased` object now emits warnings when an attribute is
accessed on an aliased class that cannot be located in the target
selectable, for those cases where the :func:`_orm.aliased` is against a
different FROM clause than the regular mapped table (such as a subquery).
This helps users identify cases where column names don't match between the
aliased class and the underlying selectable. When
:paramref:`_orm.aliased.adapt_on_names` is ``True``, the warning suggests
checking the column name; when ``False``, it suggests using the
``adapt_on_names`` parameter for name-based matching.

Fixes: #12838
Change-Id: I4294b57f24dd3fd7741e0bcbd9b521c841ace903
doc/build/changelog/unreleased_21/12838.rst [new file with mode: 0644]
lib/sqlalchemy/orm/util.py
lib/sqlalchemy/sql/util.py
test/orm/test_froms.py