]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
remove use of `LABEL_STYLE_TABLENAME_PLUS_COL` outside of Query
authorInada Naoki <songofacandy@gmail.com>
Wed, 29 Oct 2025 08:09:14 +0000 (04:09 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 10 Nov 2025 19:57:35 +0000 (14:57 -0500)
commite8fdc99e9c8d4262ad6bf2c03e572b1d3da61f76
treede6d428e3a22172d1c43219d827471f1b21d1193
parentf3fda75e3dbaf1a696f6747e113acf9e239f51ba
remove use of `LABEL_STYLE_TABLENAME_PLUS_COL` outside of Query

Changed the query style for ORM queries emitted by :meth:`.Session.get` as
well as many-to-one lazy load queries to use the default labeling style,
:attr:`_sql.SelectLabelStyle.LABEL_STYLE_DISAMBIGUATE_ONLY`, which normally
does not apply labels to columns in a SELECT statement. Previously, the
older style :attr:`_sql.SelectLabelStyle.LABEL_STYLE_TABLENAME_PLUS_COL`
that labels columns as `<tablename>_<columname>` was used for
:meth:`.Session.get` to maintain compatibility with :class:`_orm.Query`.
The change allows the string representation of ORM queries to be less
verbose in all cases outside of legacy :class:`_orm.Query` use. Pull
request courtesy Inada Naoki.

Fixes: #12932
Closes: #12926
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12926
Pull-request-sha: 6738a73f635387b8326f546313cdfd12cf9ef5ab

Change-Id: I044a54226a4fcade07adc1a3f5f60b4b3e451a1e
34 files changed:
doc/build/changelog/changelog_14.rst
doc/build/changelog/unreleased_21/12932.rst [new file with mode: 0644]
doc/build/orm/extensions/asyncio.rst
doc/build/orm/queryguide/columns.rst
doc/build/orm/queryguide/inheritance.rst
doc/build/orm/quickstart.rst
doc/build/tutorial/orm_data_manipulation.rst
doc/build/tutorial/orm_related_objects.rst
lib/sqlalchemy/orm/loading.py
lib/sqlalchemy/orm/persistence.py
lib/sqlalchemy/orm/session.py
lib/sqlalchemy/orm/strategies.py
lib/sqlalchemy/sql/selectable.py
test/orm/dml/test_update_delete_where.py
test/orm/inheritance/test_basic.py
test/orm/inheritance/test_poly_loading.py
test/orm/inheritance/test_relationship.py
test/orm/inheritance/test_single.py
test/orm/test_ac_relationships.py
test/orm/test_cascade.py
test/orm/test_defaults.py
test/orm/test_deferred.py
test/orm/test_dynamic.py
test/orm/test_eager_relations.py
test/orm/test_events.py
test/orm/test_lazy_relations.py
test/orm/test_merge.py
test/orm/test_relationship_criteria.py
test/orm/test_relationships.py
test/orm/test_selectin_relations.py
test/orm/test_subquery_relations.py
test/orm/test_unitofworkv2.py
test/orm/test_versioning.py
test/profiles.txt