From bfd9c46ebe954f8340e37bfb000c45c0b86744d9 Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Tue, 21 Oct 2025 21:07:55 +0900 Subject: [PATCH] don't use LABEL_STYLE_TABLENAME_PLUS_COL on _load_on_ident() --- lib/sqlalchemy/orm/persistence.py | 5 +---- test/orm/test_unitofworkv2.py | 12 ++++++------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/sqlalchemy/orm/persistence.py b/lib/sqlalchemy/orm/persistence.py index f720f90951..da6d053fbb 100644 --- a/lib/sqlalchemy/orm/persistence.py +++ b/lib/sqlalchemy/orm/persistence.py @@ -34,7 +34,6 @@ from .. import util from ..engine import cursor as _cursor from ..sql import operators from ..sql.elements import BooleanClauseList -from ..sql.selectable import LABEL_STYLE_TABLENAME_PLUS_COL def _save_obj(base_mapper, states, uowtransaction, single=False): @@ -1559,9 +1558,7 @@ def _finalize_insert_update_commands(base_mapper, uowtransaction, states): if toload_now: state.key = base_mapper._identity_key_from_state(state) - stmt = future.select(mapper).set_label_style( - LABEL_STYLE_TABLENAME_PLUS_COL - ) + stmt = future.select(mapper) loading._load_on_ident( uowtransaction.session, stmt, diff --git a/test/orm/test_unitofworkv2.py b/test/orm/test_unitofworkv2.py index 0a99bca962..1e981c360d 100644 --- a/test/orm/test_unitofworkv2.py +++ b/test/orm/test_unitofworkv2.py @@ -3253,12 +3253,12 @@ class EagerDefaultsSettingTest( expected_eager_defaults and not expect_returning, [ CompiledSQL( - "SELECT test.foo AS test_foo " + "SELECT test.foo " "FROM test WHERE test.id = :pk_1", [{"pk_1": 1}], ), CompiledSQL( - "SELECT test.foo AS test_foo " + "SELECT test.foo " "FROM test WHERE test.id = :pk_1", [{"pk_1": 2}], ), @@ -3373,12 +3373,12 @@ class EagerDefaultsSettingTest( expected_eager_defaults and not expect_returning, [ CompiledSQL( - "SELECT test.foo AS test_foo " + "SELECT test.foo " "FROM test WHERE test.id = :pk_1", [{"pk_1": 1}], ), CompiledSQL( - "SELECT test.foo AS test_foo " + "SELECT test.foo " "FROM test WHERE test.id = :pk_1", [{"pk_1": 2}], ), @@ -3449,12 +3449,12 @@ class EagerDefaultsSettingTest( ], ), CompiledSQL( - "SELECT test.bar AS test_bar " + "SELECT test.bar " "FROM test WHERE test.id = :pk_1", [{"pk_1": 1}], ), CompiledSQL( - "SELECT test.bar AS test_bar " + "SELECT test.bar " "FROM test WHERE test.id = :pk_1", [{"pk_1": 2}], ), -- 2.47.3