]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
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)
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

index e2d2f4d6c922468268d95e16f078b2284f9cad42..7675e734f698008519256deb4ba0dd6953455f63 100644 (file)
@@ -6663,9 +6663,10 @@ This document details individual issue-level changes made throughout
         :meth:`_sql.GenerativeSelect.apply_labels` with explicit getters and
         setters :meth:`_sql.GenerativeSelect.get_label_style` and
         :meth:`_sql.GenerativeSelect.set_label_style` to accommodate the three
-        supported label styles: :data:`_sql.LABEL_STYLE_DISAMBIGUATE_ONLY`,
-        :data:`_sql.LABEL_STYLE_TABLENAME_PLUS_COL`, and
-        :data:`_sql.LABEL_STYLE_NONE`.
+        supported label styles:
+        :attr:`_sql.SelectLabelStyle.LABEL_STYLE_DISAMBIGUATE_ONLY`,
+        :attr:`_sql.SelectLabelStyle.LABEL_STYLE_TABLENAME_PLUS_COL`, and
+        :attr:`_sql.SelectLabelStyle.LABEL_STYLE_NONE`.
 
         In addition, for Core and "future style" ORM queries,
         ``LABEL_STYLE_DISAMBIGUATE_ONLY`` is now the default label style. This
diff --git a/doc/build/changelog/unreleased_21/12932.rst b/doc/build/changelog/unreleased_21/12932.rst
new file mode 100644 (file)
index 0000000..48e42c5
--- /dev/null
@@ -0,0 +1,14 @@
+.. change::
+    :tags: usecase, sql
+    :tickets: 12932
+
+    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.
index bd14d6f2d2cfcd572c73b44d21709cb81eebce4c..31d22487010721dbe7a49d1aa4e0e510a7f662e7 100644 (file)
@@ -298,7 +298,7 @@ configuration:
     SELECT a.id, a.data, a.create_date
     FROM a ORDER BY a.id
     [...] ()
-    SELECT b.a_id AS b_a_id, b.id AS b_id, b.data AS b_data
+    SELECT b.a_id, b.id, b.data
     FROM b
     WHERE b.a_id IN (?, ?, ?)
     [...] (1, 2, 3)
index ace6a63f4ce362ea2a982a0c2d351ad3fb79e846..f461d524f8a6b7079454cfec30e01acf4e0240b5 100644 (file)
@@ -87,7 +87,7 @@ order to load the value.  Below, accessing ``.cover_photo`` emits a SELECT
 statement to load its value::
 
     >>> img_data = books[0].cover_photo
-    {execsql}SELECT book.cover_photo AS book_cover_photo
+    {execsql}SELECT book.cover_photo
     FROM book
     WHERE book.id = ?
     [...] (1,)
@@ -157,7 +157,7 @@ in addition to primary key column::
     {execsql}SELECT user_account.id, user_account.name, user_account.fullname
     FROM user_account
     [...] ()
-    SELECT book.owner_id AS book_owner_id, book.id AS book_id, book.title AS book_title
+    SELECT book.owner_id, book.id, book.title
     FROM book
     WHERE book.owner_id IN (?, ?)
     [...] (1, 2)
@@ -184,12 +184,12 @@ the SELECT statement emitted for each ``User.books`` collection::
     {execsql}SELECT user_account.id, user_account.name, user_account.fullname
     FROM user_account
     [...] ()
-    SELECT book.id AS book_id, book.title AS book_title
+    SELECT book.id, book.title
     FROM book
     WHERE ? = book.owner_id
     [...] (1,)
     {stop}Spongebob Squarepants   ['100 Years of Krabby Patties', 'Sea Catch 22', 'The Sea Grapes of Wrath']
-    {execsql}SELECT book.id AS book_id, book.title AS book_title
+    {execsql}SELECT book.id, book.title
     FROM book
     WHERE ? = book.owner_id
     [...] (2,)
@@ -223,7 +223,7 @@ As is the case with :func:`_orm.load_only`, unloaded columns by default
 will load themselves when accessed using :term:`lazy loading`::
 
     >>> img_data = books[0].cover_photo
-    {execsql}SELECT book.cover_photo AS book_cover_photo
+    {execsql}SELECT book.cover_photo
     FROM book
     WHERE book.id = ?
     [...] (4,)
@@ -354,7 +354,7 @@ on the loaded object are first accessed is that they will :term:`lazy load`
 their value::
 
     >>> img_data = book.cover_photo
-    {execsql}SELECT book.cover_photo AS book_cover_photo
+    {execsql}SELECT book.cover_photo
     FROM book
     WHERE book.id = ?
     [...] (2,)
@@ -510,7 +510,7 @@ will load both columns at once using just one SELECT statement::
     WHERE book.id = ?
     [...] (2,)
     {stop}>>> img_data, summary = book.cover_photo, book.summary
-    {execsql}SELECT book.summary AS book_summary, book.cover_photo AS book_cover_photo
+    {execsql}SELECT book.summary, book.cover_photo
     FROM book
     WHERE book.id = ?
     [...] (2,)
index 537d51ae59e60026c4133e7f2ba4066598ab048e..063bdbfd3b0a471ccd68ce718bbb790d8c84ee55 100644 (file)
@@ -211,8 +211,7 @@ we only indicate the additional target subclasses we wish to load::
     SELECT company.id, company.name
     FROM company
     [...] ()
-    SELECT employee.company_id AS employee_company_id, employee.id AS employee_id,
-    employee.name AS employee_name, employee.type AS employee_type
+    SELECT employee.company_id, employee.id, employee.name, employee.type
     FROM employee
     WHERE employee.company_id IN (?)
     [...] (1,)
@@ -273,7 +272,7 @@ this collection on all ``Manager`` objects, where the sub-attributes of
     FROM employee JOIN manager ON employee.id = manager.id
     WHERE employee.id IN (?) ORDER BY employee.id
     [...] (1,)
-    SELECT paperwork.manager_id AS paperwork_manager_id, paperwork.id AS paperwork_id, paperwork.document_name AS paperwork_document_name
+    SELECT paperwork.manager_id, paperwork.id, paperwork.document_name
     FROM paperwork
     WHERE paperwork.manager_id IN (?)
     [...] (1,)
@@ -327,7 +326,7 @@ examples to load ``Company.employees``, also loading the attributes for the
     SELECT company.id, company.name
     FROM company
     [...] ()
-    SELECT employee.company_id AS employee_company_id, employee.id AS employee_id, employee.name AS employee_name, employee.type AS employee_type
+    SELECT employee.company_id, employee.id, employee.name, employee.type
     FROM employee
     WHERE employee.company_id IN (?)
     [...] (1,)
@@ -335,7 +334,7 @@ examples to load ``Company.employees``, also loading the attributes for the
     FROM employee JOIN manager ON employee.id = manager.id
     WHERE employee.id IN (?) ORDER BY employee.id
     [...] (1,)
-    SELECT paperwork.manager_id AS paperwork_manager_id, paperwork.id AS paperwork_id, paperwork.document_name AS paperwork_document_name
+    SELECT paperwork.manager_id, paperwork.id, paperwork.document_name
     FROM paperwork
     WHERE paperwork.manager_id IN (?)
     [...] (1,)
@@ -847,10 +846,8 @@ eagerly load all elements of ``Company.employees`` using the
     {execsql}SELECT company.id, company.name
     FROM company
     [...] ()
-    SELECT employee.company_id AS employee_company_id, employee.id AS employee_id,
-    employee.name AS employee_name, employee.type AS employee_type, manager.id AS manager_id,
-    manager.manager_name AS manager_manager_name, engineer.id AS engineer_id,
-    engineer.engineer_info AS engineer_engineer_info
+    SELECT employee.company_id, employee.id, employee.name, employee.type,
+    manager.id, manager.manager_name, engineer.id, engineer.engineer_info
     FROM employee
     LEFT OUTER JOIN manager ON employee.id = manager.id
     LEFT OUTER JOIN engineer ON employee.id = engineer.id
@@ -954,7 +951,7 @@ when it's accessed::
     WHERE employee.name = ?
     [...] ('Mr. Krabs',)
     {stop}>>> mr_krabs.manager_name
-    {execsql}SELECT employee.manager_name AS employee_manager_name
+    {execsql}SELECT employee.manager_name
     FROM employee
     WHERE employee.id = ? AND employee.type IN (?)
     [...] (1, 'manager')
index e8d4a2623391e67255e833f76773f22cc9b47d4e..0b9bc2a78aafe7e565956b47309ef0d523aa4e18 100644 (file)
@@ -341,7 +341,7 @@ address associated with "sandy", and also add a new email address to
     {stop}
 
     >>> patrick.addresses.append(Address(email_address="patrickstar@sqlalchemy.org"))
-    {execsql}SELECT address.id AS address_id, address.email_address AS address_email_address, address.user_id AS address_user_id
+    {execsql}SELECT address.id, address.email_address, address.user_id
     FROM address
     WHERE ? = address.user_id
     [...] (3,){stop}
@@ -380,13 +380,13 @@ object by primary key using :meth:`_orm.Session.get`, then work with the object:
 
     >>> sandy = session.get(User, 2)
     {execsql}BEGIN (implicit)
-    SELECT user_account.id AS user_account_id, user_account.name AS user_account_name, user_account.fullname AS user_account_fullname
+    SELECT user_account.id, user_account.name, user_account.fullname
     FROM user_account
     WHERE user_account.id = ?
     [...] (2,){stop}
 
     >>> sandy.addresses.remove(sandy_address)
-    {execsql}SELECT address.id AS address_id, address.email_address AS address_email_address, address.user_id AS address_user_id
+    {execsql}SELECT address.id, address.email_address, address.user_id
     FROM address
     WHERE ? = address.user_id
     [...] (2,)
@@ -416,11 +416,11 @@ options that we configured, in this case, onto the related ``Address`` objects:
 .. sourcecode:: pycon+sql
 
     >>> session.delete(patrick)
-    {execsql}SELECT user_account.id AS user_account_id, user_account.name AS user_account_name, user_account.fullname AS user_account_fullname
+    {execsql}SELECT user_account.id, user_account.name, user_account.fullname
     FROM user_account
     WHERE user_account.id = ?
     [...] (3,)
-    SELECT address.id AS address_id, address.email_address AS address_email_address, address.user_id AS address_user_id
+    SELECT address.id, address.email_address, address.user_id
     FROM address
     WHERE ? = address.user_id
     [...] (3,)
index 9329d205245a93c09d9d667b1bf3a9f8cc785151..f576b310712c1861ab63115069be6ae12ecc759d 100644 (file)
@@ -337,8 +337,7 @@ Let's load up ``patrick`` from the database:
 .. sourcecode:: pycon+sql
 
     >>> patrick = session.get(User, 3)
-    {execsql}SELECT user_account.id AS user_account_id, user_account.name AS user_account_name,
-    user_account.fullname AS user_account_fullname
+    {execsql}SELECT user_account.id, user_account.name, user_account.fullname
     FROM user_account
     WHERE user_account.id = ?
     [...] (3,)
@@ -354,8 +353,7 @@ until the flush proceeds, which as mentioned before occurs if we emit a query:
 .. sourcecode:: pycon+sql
 
     >>> session.execute(select(User).where(User.name == "patrick")).first()
-    {execsql}SELECT address.id AS address_id, address.email_address AS address_email_address,
-    address.user_id AS address_user_id
+    {execsql}SELECT address.id, address.email_address, address.user_id
     FROM address
     WHERE ? = address.user_id
     [...] (3,)
@@ -465,8 +463,7 @@ a new transaction and refresh ``sandy`` with the current database row:
 
     >>> sandy.fullname
     {execsql}BEGIN (implicit)
-    SELECT user_account.id AS user_account_id, user_account.name AS user_account_name,
-    user_account.fullname AS user_account_fullname
+    SELECT user_account.id, user_account.name, user_account.fullname
     FROM user_account
     WHERE user_account.id = ?
     [...] (2,){stop}
@@ -548,7 +545,7 @@ a context manager as well, accomplishes the following things:
       >>> session.add(squidward)
       >>> squidward.name
       {execsql}BEGIN (implicit)
-      SELECT user_account.id AS user_account_id, user_account.name AS user_account_name, user_account.fullname AS user_account_fullname
+      SELECT user_account.id, user_account.name, user_account.fullname
       FROM user_account
       WHERE user_account.id = ?
       [...] (4,){stop}
index 48e049dd9e815a3a571d2c06e8ccd7e92e1577b4..e0dcbac871c752da603bf9869a34471cf42aff64 100644 (file)
@@ -227,8 +227,7 @@ newly generated primary key for the ``u1`` object:
 
   >>> u1.id
   {execsql}BEGIN (implicit)
-  SELECT user_account.id AS user_account_id, user_account.name AS user_account_name,
-  user_account.fullname AS user_account_fullname
+  SELECT user_account.id, user_account.name, user_account.fullname
   FROM user_account
   WHERE user_account.id = ?
   [...] (6,){stop}
@@ -242,8 +241,7 @@ we again see a :term:`lazy load` emitted in order to retrieve the objects:
 .. sourcecode:: pycon+sql
 
   >>> u1.addresses
-  {execsql}SELECT address.id AS address_id, address.email_address AS address_email_address,
-  address.user_id AS address_user_id
+  {execsql}SELECT address.id, address.email_address, address.user_id
   FROM address
   WHERE ? = address.user_id
   [...] (6,){stop}
@@ -456,8 +454,7 @@ related ``Address`` objects:
     {execsql}SELECT user_account.id, user_account.name, user_account.fullname
     FROM user_account ORDER BY user_account.id
     [...] ()
-    SELECT address.user_id AS address_user_id, address.id AS address_id,
-    address.email_address AS address_email_address
+    SELECT address.user_id, address.id, address.email_address
     FROM address
     WHERE address.user_id IN (?, ?, ?, ?, ?, ?)
     [...] (1, 2, 3, 4, 5, 6){stop}
@@ -669,7 +666,7 @@ instead::
     {execsql}SELECT user_account.id
     FROM user_account
     [...] ()
-    SELECT address.user_id AS address_user_id, address.id AS address_id
+    SELECT address.user_id, address.id
     FROM address
     WHERE address.user_id IN (?, ?, ?, ?, ?, ?)
     [...] (1, 2, 3, 4, 5, 6)
index f1d90f8d8728c5772d3510498bc4c01314b3b805..9f78711e5771318b43fc16abc470a0c47dec5724 100644 (file)
@@ -51,7 +51,6 @@ from ..engine.result import SimpleResultMetaData
 from ..sql import select
 from ..sql import util as sql_util
 from ..sql.selectable import ForUpdateArg
-from ..sql.selectable import LABEL_STYLE_TABLENAME_PLUS_COL
 from ..sql.selectable import SelectState
 from ..util import EMPTY_DICT
 from ..util.typing import TupleAny
@@ -1671,7 +1670,7 @@ def _load_scalar_attributes(mapper, state, attribute_names, passive):
 
     result = _load_on_ident(
         session,
-        select(mapper).set_label_style(LABEL_STYLE_TABLENAME_PLUS_COL),
+        select(mapper),
         identity_key,
         refresh_state=state,
         only_load_props=attribute_names,
index f720f90951a1ea9dd4fced660bdf0528f24ff6a6..8777cb5bcee04e603d2345f99cf1a02d459abf44 100644 (file)
@@ -28,13 +28,11 @@ from . import loading
 from . import sync
 from .base import state_str
 from .. import exc as sa_exc
-from .. import future
 from .. import sql
 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 +1557,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 = sql.select(mapper)
             loading._load_on_ident(
                 uowtransaction.session,
                 stmt,
index 100ef84fde0a97ed75cc5799ed2c57d3a351d8e5..56b690aa4be6c7bcb5d1f879238231ba21ee5b3a 100644 (file)
@@ -89,7 +89,6 @@ from ..sql.base import _NoArg
 from ..sql.base import CompileState
 from ..sql.schema import Table
 from ..sql.selectable import ForUpdateArg
-from ..sql.selectable import LABEL_STYLE_TABLENAME_PLUS_COL
 from ..util import deprecated_params
 from ..util import IdentitySet
 from ..util.typing import TupleAny
@@ -3903,17 +3902,11 @@ class Session(_SessionClassMethods, EventTarget):
             # TODO: this was being tested before, but this is not possible
             assert instance is not LoaderCallableStatus.PASSIVE_CLASS_MISMATCH
 
-        # set_label_style() not strictly necessary, however this will ensure
-        # that tablename_colname style is used which at the moment is
-        # asserted in a lot of unit tests :)
-
         load_options = context.QueryContext.default_load_options
 
         if populate_existing:
             load_options += {"_populate_existing": populate_existing}
-        statement = sql.select(mapper).set_label_style(
-            LABEL_STYLE_TABLENAME_PLUS_COL
-        )
+        statement = sql.select(mapper)
         if with_for_update is not None:
             statement._for_update_arg = ForUpdateArg._from_argument(
                 with_for_update
index cd0d97598f29382786c131b22e13590094d63c83..6a71316646916b5ed55cd083007a47dea834ce51 100644 (file)
@@ -1028,7 +1028,6 @@ class _LazyLoader(
         stmt = Select._create_raw_select(
             _raw_columns=[clauseelement],
             _propagate_attrs=clauseelement._propagate_attrs,
-            _label_style=LABEL_STYLE_TABLENAME_PLUS_COL,
             _compile_options=_ORMCompileState.default_compile_options,
         )
         load_options = QueryContext.default_load_options
@@ -3212,7 +3211,6 @@ class _SelectInLoader(_PostLoader, util.MemoizedSlots):
         entity_sql = effective_entity.__clause_element__()
         q = Select._create_raw_select(
             _raw_columns=[bundle_sql, entity_sql],
-            _label_style=LABEL_STYLE_TABLENAME_PLUS_COL,
             _compile_options=_ORMCompileState.default_compile_options,
             _propagate_attrs={
                 "compile_state_plugin": "orm",
index 6e62d30bc49b5babcd8b195abd78bc912c3ae071..5fe7995057b5ca6e1a5a787167313449cac40c2b 100644 (file)
@@ -4144,13 +4144,13 @@ class GenerativeSelect(DialectKWArgs, SelectBase, Generative):
 
         .. seealso::
 
-            :data:`_sql.LABEL_STYLE_DISAMBIGUATE_ONLY`
+            :attr:`_sql.SelectLabelStyle.LABEL_STYLE_DISAMBIGUATE_ONLY`
 
-            :data:`_sql.LABEL_STYLE_TABLENAME_PLUS_COL`
+            :attr:`_sql.SelectLabelStyle.LABEL_STYLE_TABLENAME_PLUS_COL`
 
-            :data:`_sql.LABEL_STYLE_NONE`
+            :attr:`_sql.SelectLabelStyle.LABEL_STYLE_NONE`
 
-            :data:`_sql.LABEL_STYLE_DEFAULT`
+            :attr:`_sql.SelectLabelStyle.LABEL_STYLE_DEFAULT`
 
         """
         if self._label_style is not style:
index 05e02a659715de6fbf87a1dfd002f17bac3eab1e..3463fae9079fcbab076e4ad3cba36a3ebd898eeb 100644 (file)
@@ -567,15 +567,15 @@ class UpdateDeleteTest(fixtures.MappedTest):
         to_assert = [
             # refresh john
             CompiledSQL(
-                "SELECT users.id AS users_id, users.name AS users_name, "
-                "users.age_int AS users_age_int FROM users "
+                "SELECT users.id, users.name, users.age_int "
+                "FROM users "
                 "WHERE users.id = :pk_1",
                 [{"pk_1": 1}],
             ),
             # refresh jill
             CompiledSQL(
-                "SELECT users.id AS users_id, users.name AS users_name, "
-                "users.age_int AS users_age_int FROM users "
+                "SELECT users.id, users.name, users.age_int "
+                "FROM users "
                 "WHERE users.id = :pk_1",
                 [{"pk_1": 3}],
             ),
@@ -585,8 +585,8 @@ class UpdateDeleteTest(fixtures.MappedTest):
             to_assert.append(
                 # refresh jane for partial attributes
                 CompiledSQL(
-                    "SELECT users.name AS users_name, "
-                    "users.age_int AS users_age_int FROM users "
+                    "SELECT users.name, users.age_int "
+                    "FROM users "
                     "WHERE users.id = :pk_1",
                     [{"pk_1": 4}],
                 )
@@ -711,15 +711,15 @@ class UpdateDeleteTest(fixtures.MappedTest):
         asserter.assert_(
             # refresh john
             CompiledSQL(
-                "SELECT users.id AS users_id, users.name AS users_name, "
-                "users.age_int AS users_age_int FROM users "
+                "SELECT users.id, users.name, users.age_int "
+                "FROM users "
                 "WHERE users.id = :pk_1",
                 [{"pk_1": 1}],
             ),
             # refresh jill
             CompiledSQL(
-                "SELECT users.id AS users_id, users.name AS users_name, "
-                "users.age_int AS users_age_int FROM users "
+                "SELECT users.id, users.name, users.age_int "
+                "FROM users "
                 "WHERE users.id = :pk_1",
                 [{"pk_1": 3}],
             ),
index 9028fd25a43012397fe1e6afb7315f48f94f9a7a..f84807fa9286dd259d6fdc4e8cc3f87d5520dd12 100644 (file)
@@ -1706,8 +1706,7 @@ class PassiveDeletesTest(fixtures.MappedTest):
             s.flush()
         asserter.assert_(
             CompiledSQL(
-                "SELECT a.id AS a_id, a.type AS a_type "
-                "FROM a WHERE a.id = :pk_1",
+                "SELECT a.id, a.type FROM a WHERE a.id = :pk_1",
                 [{"pk_1": 1}],
             ),
             CompiledSQL("DELETE FROM a WHERE a.id = :id", [{"id": 1}]),
@@ -1748,8 +1747,7 @@ class PassiveDeletesTest(fixtures.MappedTest):
             s.flush()
         asserter.assert_(
             CompiledSQL(
-                "SELECT a.id AS a_id, a.type AS a_type "
-                "FROM a WHERE a.id = :pk_1",
+                "SELECT a.id, a.type FROM a WHERE a.id = :pk_1",
                 [{"pk_1": 1}],
             ),
             CompiledSQL("DELETE FROM a WHERE a.id = :id", [{"id": 1}]),
@@ -1786,8 +1784,7 @@ class PassiveDeletesTest(fixtures.MappedTest):
             s.flush()
         asserter.assert_(
             CompiledSQL(
-                "SELECT a.id AS a_id, a.type AS a_type "
-                "FROM a WHERE a.id = :pk_1",
+                "SELECT a.id, a.type FROM a WHERE a.id = :pk_1",
                 [{"pk_1": 1}],
             ),
             CompiledSQL("DELETE FROM a WHERE a.id = :id", [{"id": 1}]),
@@ -2875,11 +2872,9 @@ class OptimizedLoadTest(fixtures.MappedTest):
             testing.db,
             go,
             CompiledSQL(
-                "SELECT base.id AS base_id, sub.id AS sub_id, "
-                "base.data AS base_data, base.type AS base_type, "
-                "base.counter AS base_counter, "
-                "sub.subcounter AS sub_subcounter, "
-                "sub.sub AS sub_sub, sub.subcounter2 AS sub_subcounter2 "
+                "SELECT base.id, sub.id AS id_1, "
+                "base.data, base.type, base.counter, "
+                "sub.subcounter, sub.sub, sub.subcounter2 "
                 "FROM base LEFT OUTER JOIN sub ON base.id = sub.id "
                 "WHERE base.id = :pk_1",
                 {"pk_1": sjb_id},
@@ -3222,9 +3217,9 @@ class OptimizedLoadTest(fixtures.MappedTest):
                         bool(eager_defaults),
                         [
                             CompiledSQL(
-                                "SELECT base.counter AS base_counter, "
-                                "sub.subcounter AS sub_subcounter, "
-                                "sub.subcounter2 AS sub_subcounter2 "
+                                "SELECT base.counter, "
+                                "sub.subcounter, "
+                                "sub.subcounter2 "
                                 "FROM base JOIN sub ON base.id = sub.id "
                                 "WHERE base.id = :pk_1",
                                 lambda ctx: {"pk_1": s1.id},
@@ -3246,9 +3241,8 @@ class OptimizedLoadTest(fixtures.MappedTest):
                 not eager_defaults and not expect_returning,
                 [
                     CompiledSQL(
-                        "SELECT base.counter AS base_counter, "
-                        "sub.subcounter AS sub_subcounter, sub.subcounter2 "
-                        "AS sub_subcounter2 FROM base "
+                        "SELECT base.counter, sub.subcounter, sub.subcounter2 "
+                        "FROM base "
                         "JOIN sub ON base.id = sub.id WHERE base.id = :pk_1",
                         lambda ctx: {"pk_1": s1.id},
                     )
index cf7d3146652b4ffe0029dd5729f3c51bfe95d0b3..9bdb695e17d0e1c464d8e8f6d26d3d415e92b457 100644 (file)
@@ -137,15 +137,14 @@ class BaseAndSubFixture:
                         # cols a.id / asub.id are listed in the mapper's
                         # equivalent_columns so they are guaranteed to store
                         # the same value.
-                        "SELECT c.a_sub_id AS c_a_sub_id, "
-                        "c.id AS c_id "
+                        "SELECT c.a_sub_id, c.id "
                         "FROM c WHERE c.a_sub_id "
                         "IN (__[POSTCOMPILE_primary_keys])",
                         {"primary_keys": [2]},
                     ),
                 ),
                 CompiledSQL(
-                    "SELECT b.a_id AS b_a_id, b.id AS b_id FROM b "
+                    "SELECT b.a_id, b.id FROM b "
                     "WHERE b.a_id IN (__[POSTCOMPILE_primary_keys])",
                     {"primary_keys": [1, 2]},
                 ),
@@ -340,9 +339,9 @@ class FixtureLoadTest(_Polymorphic, testing.AssertsExecutionResults):
                 {},
             ),
             CompiledSQL(
-                "SELECT people.company_id AS people_company_id, "
-                "people.person_id AS people_person_id, "
-                "people.name AS people_name, people.type AS people_type "
+                "SELECT people.company_id, "
+                "people.person_id, "
+                "people.name, people.type "
                 "FROM people WHERE people.company_id "
                 "IN (__[POSTCOMPILE_primary_keys]) "
                 "ORDER BY people.person_id",
@@ -404,9 +403,9 @@ class FixtureLoadTest(_Polymorphic, testing.AssertsExecutionResults):
                 {},
             ),
             CompiledSQL(
-                "SELECT people.company_id AS people_company_id, "
-                "people.person_id AS people_person_id, "
-                "people.name AS people_name, people.type AS people_type "
+                "SELECT people.company_id, "
+                "people.person_id, "
+                "people.name, people.type "
                 "FROM people WHERE people.company_id "
                 "IN (__[POSTCOMPILE_primary_keys]) "
                 "ORDER BY people.person_id",
@@ -439,9 +438,9 @@ class FixtureLoadTest(_Polymorphic, testing.AssertsExecutionResults):
                     {"primary_keys": [1, 2, 5]},
                 ),
                 CompiledSQL(
-                    "SELECT machines.engineer_id AS machines_engineer_id, "
-                    "machines.machine_id AS machines_machine_id, "
-                    "machines.name AS machines_name "
+                    "SELECT machines.engineer_id, "
+                    "machines.machine_id, "
+                    "machines.name "
                     "FROM machines "
                     "WHERE machines.engineer_id "
                     "IN (__[POSTCOMPILE_primary_keys]) "
@@ -1322,8 +1321,8 @@ class IgnoreOptionsOnSubclassAttrLoad(fixtures.DeclarativeMappedTest):
         if will_lazyload:
             expected.append(
                 CompiledSQL(
-                    "SELECT entity.id AS entity_id, "
-                    "entity.type AS entity_type FROM entity "
+                    "SELECT entity.id, "
+                    "entity.type FROM entity "
                     "WHERE entity.id = :pk_1",
                     [{"pk_1": entity_id}],
                 )
index 49f8c9062086e0e05394742d4a7d251c62fffdb3..82ec9ebeeaae8cf010cf39ae2d7bbf766a97be60 100644 (file)
@@ -3198,9 +3198,9 @@ class SingleSubclassInRelationship(
 
         asserter.assert_(
             CompiledSQL(
-                "SELECT log_entry_1.id AS log_entry_1_id, "
-                "log_entry_1.timestamp AS log_entry_1_timestamp, "
-                "log_entry_1.type AS log_entry_1_type "
+                "SELECT log_entry_1.id, "
+                "log_entry_1.timestamp, "
+                "log_entry_1.type "
                 "FROM log_entry AS log_entry_1 "
                 "WHERE log_entry_1.timestamp >= :param_1 AND "
                 "((SELECT min(log_entry_2.timestamp) AS min_1 "
index 0f15ac4a511c0300e9544f01ae06bc182a0b124c..a26aed1cf1eb731adb82e2a46119c3a49081216d 100644 (file)
@@ -2610,11 +2610,10 @@ class AbstractPolymorphicTest(
                 ],
             ),
             CompiledSQL(
-                "SELECT employee.company_id AS employee_company_id, "
-                "employee.id AS employee_id, employee.name AS employee_name, "
-                "employee.type AS employee_type, "
-                "employee.executive_background AS "
-                "employee_executive_background "
+                "SELECT employee.company_id, "
+                "employee.id, employee.name, "
+                "employee.type, "
+                "employee.executive_background "
                 "FROM employee WHERE employee.company_id "
                 "IN (__[POSTCOMPILE_primary_keys]) "
                 "AND employee.type IN (__[POSTCOMPILE_type_1])",
index 34f4e37ee49c5b8804f23cc5b4c0db974c9344a0..c4ff8d7de3734dd36b3161da8f2df3c99f48e981 100644 (file)
@@ -272,7 +272,7 @@ class AltSelectableTest(
 
         asserter.assert_(
             CompiledSQL(
-                "SELECT b.id AS b_id FROM b JOIN d ON d.b_id = b.id "
+                "SELECT b.id FROM b JOIN d ON d.b_id = b.id "
                 "JOIN c ON c.id = d.c_id WHERE :param_1 = b.id",
                 [{"param_1": 1}],
             )
@@ -318,7 +318,7 @@ class AltSelectableTest(
                 [{"param_1": 1}],
             ),
             CompiledSQL(
-                "SELECT a_1.id AS a_1_id, b.id AS b_id FROM a AS a_1 "
+                "SELECT a_1.id, b.id FROM a AS a_1 "
                 "JOIN (b JOIN d ON d.b_id = b.id JOIN c ON c.id = d.c_id) "
                 "ON a_1.b_id = b.id WHERE a_1.id "
                 "IN (__[POSTCOMPILE_primary_keys])",
index a7c326f730181c178ef8dd17084638c1d1ca6e67..c91fc8e99361a3ea9de1df1c3de59dc85cf97754 100644 (file)
@@ -1094,8 +1094,7 @@ class M2OwNoUseGetCascadeTest(
             sess.flush,
             # looking for other bs'
             CompiledSQL(
-                "SELECT b.id AS b_id, b.email AS b_email "
-                "FROM b WHERE :param_1 = b.email",
+                "SELECT b.id, b.email " "FROM b WHERE :param_1 = b.email",
                 lambda ctx: [{"param_1": "x"}],
             ),
             CompiledSQL(
@@ -1127,8 +1126,7 @@ class M2OwNoUseGetCascadeTest(
             # we would like it to be able to skip this SELECT but this is not
             # implemented right now
             CompiledSQL(
-                "SELECT a.id AS a_id, a.email AS a_email FROM a "
-                "WHERE a.email = :param_1",
+                "SELECT a.id, a.email FROM a " "WHERE a.email = :param_1",
                 [{"param_1": "x"}],
             ),
             CompiledSQL(
index d230d4aafc0658af77ff826f8d0071d9f5888ced..0b0ad90943a1db638a86f621d7263b2b55ad2d82 100644 (file)
@@ -319,13 +319,11 @@ class ComputedDefaultsOnUpdateTest(fixtures.MappedTest):
                         [{"foo": 5, "id": 1}, {"foo": 10, "id": 2}],
                     ),
                     CompiledSQL(
-                        "SELECT test.bar AS test_bar FROM test "
-                        "WHERE test.id = :pk_1",
+                        "SELECT test.bar FROM test WHERE test.id = :pk_1",
                         [{"pk_1": 1}],
                     ),
                     CompiledSQL(
-                        "SELECT test.bar AS test_bar FROM test "
-                        "WHERE test.id = :pk_1",
+                        "SELECT test.bar FROM test WHERE test.id = :pk_1",
                         [{"pk_1": 2}],
                     ),
                 ],
@@ -390,14 +388,12 @@ class ComputedDefaultsOnUpdateTest(fixtures.MappedTest):
                     enable_returning=False,
                 ),
                 CompiledSQL(
-                    "SELECT test.bar AS test_bar FROM test "
-                    "WHERE test.id = :pk_1",
+                    "SELECT test.bar FROM test WHERE test.id = :pk_1",
                     [{"pk_1": 1}],
                     enable_returning=False,
                 ),
                 CompiledSQL(
-                    "SELECT test.bar AS test_bar FROM test "
-                    "WHERE test.id = :pk_1",
+                    "SELECT test.bar FROM test WHERE test.id = :pk_1",
                     [{"pk_1": 2}],
                     enable_returning=False,
                 ),
@@ -409,13 +405,11 @@ class ComputedDefaultsOnUpdateTest(fixtures.MappedTest):
                     [{"foo": 5, "test_id": 1}, {"foo": 6, "test_id": 2}],
                 ),
                 CompiledSQL(
-                    "SELECT test.bar AS test_bar FROM test "
-                    "WHERE test.id = :pk_1",
+                    "SELECT test.bar FROM test WHERE test.id = :pk_1",
                     [{"pk_1": 1}],
                 ),
                 CompiledSQL(
-                    "SELECT test.bar AS test_bar FROM test "
-                    "WHERE test.id = :pk_1",
+                    "SELECT test.bar FROM test WHERE test.id = :pk_1",
                     [{"pk_1": 2}],
                 ),
             )
index dbfe3ef7974d21df7aaffa04e81fb30ce44fabba..95c362d8fac55159f7bde7093f629e461dd87913 100644 (file)
@@ -90,7 +90,7 @@ class DeferredTest(AssertsCompiledSQL, _fixtures.FixtureTest):
                     {},
                 ),
                 (
-                    "SELECT orders.description AS orders_description "
+                    "SELECT orders.description "
                     "FROM orders WHERE orders.id = :pk_1",
                     {"pk_1": 3},
                 ),
@@ -131,7 +131,7 @@ class DeferredTest(AssertsCompiledSQL, _fixtures.FixtureTest):
                     {},
                 ),
                 (
-                    "SELECT orders.description AS orders_description "
+                    "SELECT orders.description "
                     "FROM orders WHERE orders.id = :pk_1",
                     {"pk_1": 3},
                 ),
@@ -383,10 +383,10 @@ class DeferredTest(AssertsCompiledSQL, _fixtures.FixtureTest):
                     {},
                 ),
                 (
-                    "SELECT orders.user_id AS orders_user_id, "
-                    "orders.address_id AS orders_address_id, "
-                    "orders.description AS orders_description, "
-                    "orders.isopen AS orders_isopen "
+                    "SELECT orders.user_id, "
+                    "orders.address_id, "
+                    "orders.description, "
+                    "orders.isopen "
                     "FROM orders WHERE orders.id = :pk_1",
                     {"pk_1": 3},
                 ),
@@ -516,7 +516,7 @@ class DeferredOptionsTest(AssertsCompiledSQL, _fixtures.FixtureTest):
                     {},
                 ),
                 (
-                    "SELECT orders.user_id AS orders_user_id "
+                    "SELECT orders.user_id "
                     "FROM orders WHERE orders.id = :pk_1",
                     {"pk_1": 1},
                 ),
@@ -755,7 +755,7 @@ class DeferredOptionsTest(AssertsCompiledSQL, _fixtures.FixtureTest):
                     {"id_1": 3},
                 ),
                 (
-                    "SELECT users.id AS users_id, users.name AS users_name "
+                    "SELECT users.id, users.name "
                     "FROM users WHERE users.id IN "
                     "(__[POSTCOMPILE_primary_keys])",
                     [{"primary_keys": [7]}],
@@ -814,11 +814,11 @@ class DeferredOptionsTest(AssertsCompiledSQL, _fixtures.FixtureTest):
                     {"id_1": 7},
                 ),
                 (
-                    "SELECT orders.id AS orders_id, "
-                    "orders.user_id AS orders_user_id, "
-                    "orders.address_id AS orders_address_id, "
-                    "orders.description AS orders_description, "
-                    "orders.isopen AS orders_isopen "
+                    "SELECT orders.id, "
+                    "orders.user_id, "
+                    "orders.address_id, "
+                    "orders.description, "
+                    "orders.isopen "
                     "FROM orders WHERE :param_1 = orders.user_id "
                     "ORDER BY orders.id",
                     {"param_1": 7},
@@ -1456,14 +1456,14 @@ class DeferredOptionsTest(AssertsCompiledSQL, _fixtures.FixtureTest):
                 {"id_1": [7, 8]},
             ),
             (
-                "SELECT addresses.id AS addresses_id, "
-                "addresses.email_address AS addresses_email_address "
+                "SELECT addresses.id, "
+                "addresses.email_address "
                 "FROM addresses WHERE :param_1 = addresses.user_id",
                 {"param_1": 7},
             ),
             (
-                "SELECT addresses.id AS addresses_id, "
-                "addresses.email_address AS addresses_email_address "
+                "SELECT addresses.id, "
+                "addresses.email_address "
                 "FROM addresses WHERE :param_1 = addresses.user_id",
                 {"param_1": 8},
             ),
index 9378f1ef50c909480507408a13b1addf3240bb7e..9c69c10db29858b0eb909df888dacdeb95b57326 100644 (file)
@@ -1127,7 +1127,7 @@ class _UOWTests:
             testing.db,
             sess.flush,
             CompiledSQL(
-                "SELECT users.id AS users_id, users.name AS users_name "
+                "SELECT users.id, users.name "
                 "FROM users WHERE users.id = :pk_1",
                 lambda ctx: [{"pk_1": u1_id}],
             ),
@@ -1160,8 +1160,8 @@ class _UOWTests:
             testing.db,
             sess.flush,
             CompiledSQL(
-                "SELECT addresses.id AS addresses_id, addresses.email_address "
-                "AS addresses_email_address FROM addresses "
+                "SELECT addresses.id, addresses.email_address "
+                "FROM addresses "
                 "WHERE addresses.id = :pk_1",
                 lambda ctx: [{"pk_1": a2_id}],
             ),
@@ -1171,7 +1171,7 @@ class _UOWTests:
                 lambda ctx: [{"addresses_id": a2_id, "user_id": None}],
             ),
             CompiledSQL(
-                "SELECT users.id AS users_id, users.name AS users_name "
+                "SELECT users.id, users.name "
                 "FROM users WHERE users.id = :pk_1",
                 lambda ctx: [{"pk_1": u1_id}],
             ),
index 80178582c6e00e1e9bab5191a4a90682a7a52428..18c443a6b7c3577f284061410995fc662d102f52 100644 (file)
@@ -1665,10 +1665,10 @@ class EagerTest(_fixtures.FixtureTest, testing.AssertsCompiledSQL):
                 testing.db,
                 go,
                 CompiledSQL(
-                    "SELECT addresses.id AS addresses_id, "
-                    "addresses.user_id AS "
-                    "addresses_user_id, addresses.email_address AS "
-                    "addresses_email_address FROM addresses WHERE :param_1 = "
+                    "SELECT addresses.id, "
+                    "addresses.user_id, "
+                    "addresses.email_address "
+                    "FROM addresses WHERE :param_1 = "
                     "addresses.user_id",
                     {"param_1": 8},
                 ),
@@ -1716,10 +1716,10 @@ class EagerTest(_fixtures.FixtureTest, testing.AssertsCompiledSQL):
                 testing.db,
                 go,
                 CompiledSQL(
-                    "SELECT addresses.id AS addresses_id, "
-                    "addresses.user_id AS "
-                    "addresses_user_id, addresses.email_address AS "
-                    "addresses_email_address FROM addresses WHERE :param_1 = "
+                    "SELECT addresses.id, "
+                    "addresses.user_id, "
+                    "addresses.email_address "
+                    "FROM addresses WHERE :param_1 = "
                     "addresses.user_id",
                     {"param_1": 8},
                 ),
@@ -3122,11 +3122,11 @@ class EagerTest(_fixtures.FixtureTest, testing.AssertsCompiledSQL):
                     {"id_1": 7},
                 ),
                 (
-                    "SELECT orders.id AS orders_id, "
-                    "orders.user_id AS orders_user_id, "
-                    "orders.address_id AS orders_address_id, "
-                    "orders.description AS orders_description, "
-                    "orders.isopen AS orders_isopen FROM orders "
+                    "SELECT orders.id, "
+                    "orders.user_id, "
+                    "orders.address_id, "
+                    "orders.description, "
+                    "orders.isopen FROM orders "
                     "WHERE :param_1 = orders.user_id",
                     {"param_1": 7},
                 ),
@@ -7032,8 +7032,8 @@ class SecondaryOptionsTest(fixtures.MappedTest):
             testing.db,
             lambda: c1.child2,
             CompiledSQL(
-                "SELECT child2.id AS child2_id, base.id AS base_id, "
-                "base.type AS base_type "
+                "SELECT child2.id, base.id, "
+                "base.type "
                 "FROM base JOIN child2 ON base.id = child2.id "
                 "WHERE base.id = :pk_1",
                 {"pk_1": 4},
@@ -7070,8 +7070,8 @@ class SecondaryOptionsTest(fixtures.MappedTest):
             testing.db,
             lambda: c1.child2,
             CompiledSQL(
-                "SELECT child2.id AS child2_id, base.id AS base_id, "
-                "base.type AS base_type "
+                "SELECT child2.id, base.id, "
+                "base.type "
                 "FROM base JOIN child2 ON base.id = child2.id "
                 "WHERE base.id = :pk_1",
                 {"pk_1": 4},
@@ -7113,9 +7113,9 @@ class SecondaryOptionsTest(fixtures.MappedTest):
             testing.db,
             lambda: c1.child2,
             CompiledSQL(
-                "SELECT child2.id AS child2_id, base.id AS base_id, "
-                "base.type AS base_type, "
-                "related_1.id AS related_1_id FROM base JOIN child2 "
+                "SELECT child2.id, base.id, "
+                "base.type, "
+                "related_1.id FROM base JOIN child2 "
                 "ON base.id = child2.id "
                 "LEFT OUTER JOIN related AS related_1 "
                 "ON base.id = related_1.id WHERE base.id = :pk_1",
index 642ac6edd4bab30fd12429ae5ec03c52c9e67992..536aa654f7e8118b866ae091a2482fcd0da8441d 100644 (file)
@@ -140,9 +140,8 @@ class ORMExecuteTest(RemoveORMEventsGlobally, _fixtures.FixtureTest):
                 [{"id_1": 7}],
             ),
             CompiledSQL(
-                "SELECT addresses.id AS addresses_id, addresses.user_id AS "
-                "addresses_user_id, "
-                "addresses.email_address AS addresses_email_address "
+                "SELECT addresses.id, addresses.user_id, "
+                "addresses.email_address "
                 "FROM addresses WHERE :param_1 = addresses.user_id "
                 "ORDER BY addresses.id",
                 [{"param_1": 7}],
index 9bb8071984dbefc02118ffe3fd1ec7e4a8c1f579..ff8063cc3a2fd929b546d2ec3392fe0d0d62fe25 100644 (file)
@@ -1499,8 +1499,8 @@ class O2MWOSideFixedTest(fixtures.MappedTest):
             testing.db,
             go,
             CompiledSQL(
-                "SELECT person.id AS person_id, person.city_id AS "
-                "person_city_id FROM person WHERE person.city_id = :param_1 "
+                "SELECT person.id, person.city_id "
+                "FROM person WHERE person.city_id = :param_1 "
                 "AND :param_2 = 0",
                 {"param_1": 2, "param_2": 1},
             ),
@@ -1690,8 +1690,8 @@ class TypeCoerceTest(fixtures.MappedTest, testing.AssertsExecutionResults):
 
         asserter.assert_(
             CompiledSQL(
-                "SELECT pets.id AS pets_id, pets.person_id AS "
-                "pets_person_id FROM pets WHERE pets.person_id = "
+                "SELECT pets.id, pets.person_id "
+                "FROM pets WHERE pets.person_id = "
                 "CAST(:param_1 AS INTEGER)",
                 [{"param_1": 5}],
             )
index 9fb16a2ce1bc9762e2cd09585ca068f2a834c291..0df14df56d1abdaf558a0261d98c2cc2b27c9172 100644 (file)
@@ -2048,13 +2048,11 @@ class DeferredMergeTest(fixtures.MappedTest):
             go,
             [
                 (
-                    "SELECT book.summary AS book_summary "
-                    "FROM book WHERE book.id = :pk_1",
+                    "SELECT book.summary FROM book WHERE book.id = :pk_1",
                     {"pk_1": 1},
                 ),
                 (
-                    "SELECT book.excerpt AS book_excerpt "
-                    "FROM book WHERE book.id = :pk_1",
+                    "SELECT book.excerpt FROM book WHERE book.id = :pk_1",
                     {"pk_1": 1},
                 ),
             ],
@@ -2094,13 +2092,11 @@ class DeferredMergeTest(fixtures.MappedTest):
             go,
             [
                 (
-                    "SELECT book.summary AS book_summary "
-                    "FROM book WHERE book.id = :pk_1",
+                    "SELECT book.summary FROM book WHERE book.id = :pk_1",
                     {"pk_1": 1},
                 ),
                 (
-                    "SELECT book.excerpt AS book_excerpt "
-                    "FROM book WHERE book.id = :pk_1",
+                    "SELECT book.excerpt FROM book WHERE book.id = :pk_1",
                     {"pk_1": 1},
                 ),
             ],
index 29720f7dc8658997a56e42915a169111c38e41eb..90c3243eac8d08376a564b15e2b00ca56e756bd7 100644 (file)
@@ -955,9 +955,9 @@ class LoaderCriteriaTest(_Fixtures, testing.AssertsCompiledSQL):
                 [],
             ),
             CompiledSQL(
-                "SELECT addresses.user_id AS addresses_user_id, addresses.id "
-                "AS addresses_id, addresses.email_address "
-                "AS addresses_email_address FROM addresses "
+                "SELECT addresses.user_id, addresses.id, "
+                "addresses.email_address "
+                "FROM addresses "
                 "WHERE addresses.user_id IN (__[POSTCOMPILE_primary_keys]) "
                 "AND addresses.email_address != :email_address_1 "
                 "ORDER BY addresses.id",
@@ -991,9 +991,9 @@ class LoaderCriteriaTest(_Fixtures, testing.AssertsCompiledSQL):
                 [],
             ),
             CompiledSQL(
-                "SELECT addresses.user_id AS addresses_user_id, addresses.id "
-                "AS addresses_id, addresses.email_address "
-                "AS addresses_email_address FROM addresses "
+                "SELECT addresses.user_id, addresses.id, "
+                "addresses.email_address "
+                "FROM addresses "
                 "WHERE addresses.user_id IN (__[POSTCOMPILE_primary_keys]) "
                 "AND addresses.email_address != :closure_1 "
                 "ORDER BY addresses.id",
@@ -1011,9 +1011,9 @@ class LoaderCriteriaTest(_Fixtures, testing.AssertsCompiledSQL):
                 [],
             ),
             CompiledSQL(
-                "SELECT addresses.user_id AS addresses_user_id, addresses.id "
-                "AS addresses_id, addresses.email_address "
-                "AS addresses_email_address FROM addresses "
+                "SELECT addresses.user_id, addresses.id, "
+                "addresses.email_address "
+                "FROM addresses "
                 "WHERE addresses.user_id IN (__[POSTCOMPILE_primary_keys]) "
                 "AND addresses.email_address != :closure_1 "
                 "ORDER BY addresses.id",
@@ -1046,36 +1046,36 @@ class LoaderCriteriaTest(_Fixtures, testing.AssertsCompiledSQL):
                 [],
             ),
             CompiledSQL(
-                "SELECT addresses.id AS addresses_id, "
-                "addresses.user_id AS addresses_user_id, "
-                "addresses.email_address AS addresses_email_address "
+                "SELECT addresses.id, "
+                "addresses.user_id, "
+                "addresses.email_address "
                 "FROM addresses WHERE :param_1 = addresses.user_id "
                 "AND addresses.email_address != :email_address_1 "
                 "ORDER BY addresses.id",
                 [{"param_1": 7, "email_address_1": "name"}],
             ),
             CompiledSQL(
-                "SELECT addresses.id AS addresses_id, "
-                "addresses.user_id AS addresses_user_id, "
-                "addresses.email_address AS addresses_email_address "
+                "SELECT addresses.id, "
+                "addresses.user_id, "
+                "addresses.email_address "
                 "FROM addresses WHERE :param_1 = addresses.user_id "
                 "AND addresses.email_address != :email_address_1 "
                 "ORDER BY addresses.id",
                 [{"param_1": 8, "email_address_1": "name"}],
             ),
             CompiledSQL(
-                "SELECT addresses.id AS addresses_id, "
-                "addresses.user_id AS addresses_user_id, "
-                "addresses.email_address AS addresses_email_address "
+                "SELECT addresses.id, "
+                "addresses.user_id, "
+                "addresses.email_address "
                 "FROM addresses WHERE :param_1 = addresses.user_id "
                 "AND addresses.email_address != :email_address_1 "
                 "ORDER BY addresses.id",
                 [{"param_1": 9, "email_address_1": "name"}],
             ),
             CompiledSQL(
-                "SELECT addresses.id AS addresses_id, "
-                "addresses.user_id AS addresses_user_id, "
-                "addresses.email_address AS addresses_email_address "
+                "SELECT addresses.id, "
+                "addresses.user_id, "
+                "addresses.email_address "
                 "FROM addresses WHERE :param_1 = addresses.user_id "
                 "AND addresses.email_address != :email_address_1 "
                 "ORDER BY addresses.id",
@@ -1114,36 +1114,36 @@ class LoaderCriteriaTest(_Fixtures, testing.AssertsCompiledSQL):
                 [],
             ),
             CompiledSQL(
-                "SELECT addresses.id AS addresses_id, "
-                "addresses.user_id AS addresses_user_id, "
-                "addresses.email_address AS addresses_email_address "
+                "SELECT addresses.id, "
+                "addresses.user_id, "
+                "addresses.email_address "
                 "FROM addresses WHERE :param_1 = addresses.user_id "
                 "AND addresses.email_address != :closure_1 "
                 "ORDER BY addresses.id",
                 [{"param_1": 7, "closure_1": "name"}],
             ),
             CompiledSQL(
-                "SELECT addresses.id AS addresses_id, "
-                "addresses.user_id AS addresses_user_id, "
-                "addresses.email_address AS addresses_email_address "
+                "SELECT addresses.id, "
+                "addresses.user_id, "
+                "addresses.email_address "
                 "FROM addresses WHERE :param_1 = addresses.user_id "
                 "AND addresses.email_address != :closure_1 "
                 "ORDER BY addresses.id",
                 [{"param_1": 8, "closure_1": "name"}],
             ),
             CompiledSQL(
-                "SELECT addresses.id AS addresses_id, "
-                "addresses.user_id AS addresses_user_id, "
-                "addresses.email_address AS addresses_email_address "
+                "SELECT addresses.id, "
+                "addresses.user_id, "
+                "addresses.email_address "
                 "FROM addresses WHERE :param_1 = addresses.user_id "
                 "AND addresses.email_address != :closure_1 "
                 "ORDER BY addresses.id",
                 [{"param_1": 9, "closure_1": "name"}],
             ),
             CompiledSQL(
-                "SELECT addresses.id AS addresses_id, "
-                "addresses.user_id AS addresses_user_id, "
-                "addresses.email_address AS addresses_email_address "
+                "SELECT addresses.id, "
+                "addresses.user_id, "
+                "addresses.email_address "
                 "FROM addresses WHERE :param_1 = addresses.user_id "
                 "AND addresses.email_address != :closure_1 "
                 "ORDER BY addresses.id",
@@ -1164,36 +1164,36 @@ class LoaderCriteriaTest(_Fixtures, testing.AssertsCompiledSQL):
                 [],
             ),
             CompiledSQL(
-                "SELECT addresses.id AS addresses_id, "
-                "addresses.user_id AS addresses_user_id, "
-                "addresses.email_address AS addresses_email_address "
+                "SELECT addresses.id, "
+                "addresses.user_id, "
+                "addresses.email_address "
                 "FROM addresses WHERE :param_1 = addresses.user_id "
                 "AND addresses.email_address != :closure_1 "
                 "ORDER BY addresses.id",
                 [{"param_1": 7, "closure_1": "new name"}],
             ),
             CompiledSQL(
-                "SELECT addresses.id AS addresses_id, "
-                "addresses.user_id AS addresses_user_id, "
-                "addresses.email_address AS addresses_email_address "
+                "SELECT addresses.id, "
+                "addresses.user_id, "
+                "addresses.email_address "
                 "FROM addresses WHERE :param_1 = addresses.user_id "
                 "AND addresses.email_address != :closure_1 "
                 "ORDER BY addresses.id",
                 [{"param_1": 8, "closure_1": "new name"}],
             ),
             CompiledSQL(
-                "SELECT addresses.id AS addresses_id, "
-                "addresses.user_id AS addresses_user_id, "
-                "addresses.email_address AS addresses_email_address "
+                "SELECT addresses.id, "
+                "addresses.user_id, "
+                "addresses.email_address "
                 "FROM addresses WHERE :param_1 = addresses.user_id "
                 "AND addresses.email_address != :closure_1 "
                 "ORDER BY addresses.id",
                 [{"param_1": 9, "closure_1": "new name"}],
             ),
             CompiledSQL(
-                "SELECT addresses.id AS addresses_id, "
-                "addresses.user_id AS addresses_user_id, "
-                "addresses.email_address AS addresses_email_address "
+                "SELECT addresses.id, "
+                "addresses.user_id, "
+                "addresses.email_address "
                 "FROM addresses WHERE :param_1 = addresses.user_id "
                 "AND addresses.email_address != :closure_1 "
                 "ORDER BY addresses.id",
@@ -1993,9 +1993,9 @@ class RelationshipCriteriaTest(_Fixtures, testing.AssertsCompiledSQL):
                     "SELECT users.id, users.name FROM users ORDER BY users.id"
                 ),
                 CompiledSQL(
-                    "SELECT addresses.user_id AS addresses_user_id, "
-                    "addresses.id AS addresses_id, addresses.email_address "
-                    "AS addresses_email_address FROM addresses "
+                    "SELECT addresses.user_id, addresses.id, "
+                    "addresses.email_address "
+                    "FROM addresses "
                     "WHERE addresses.user_id IN "
                     "(__[POSTCOMPILE_primary_keys]) "
                     "AND addresses.email_address != :email_address_1 "
@@ -2052,9 +2052,8 @@ class RelationshipCriteriaTest(_Fixtures, testing.AssertsCompiledSQL):
                     "SELECT users.id, users.name FROM users ORDER BY users.id"
                 ),
                 CompiledSQL(
-                    "SELECT addresses.user_id AS addresses_user_id, "
-                    "addresses.id AS addresses_id, "
-                    "addresses.email_address AS addresses_email_address "
+                    "SELECT addresses.user_id, addresses.id, "
+                    "addresses.email_address "
                     # note the comma-separated FROM clause
                     "FROM addresses, (SELECT addresses_1.id AS id FROM "
                     "addresses AS addresses_1 "
@@ -2246,13 +2245,13 @@ class RelationshipCriteriaTest(_Fixtures, testing.AssertsCompiledSQL):
                     [{"id_1": 7}],
                 ),
                 CompiledSQL(
-                    "SELECT orders.user_id AS orders_user_id, "
-                    "orders.id AS orders_id, "
-                    "orders.address_id AS orders_address_id, "
-                    "orders.description AS orders_description, "
-                    "orders.isopen AS orders_isopen, "
-                    "items_1.id AS items_1_id, "
-                    "items_1.description AS items_1_description "
+                    "SELECT orders.user_id, "
+                    "orders.id, "
+                    "orders.address_id, "
+                    "orders.description, "
+                    "orders.isopen, "
+                    "items_1.id, "
+                    "items_1.description "
                     "FROM orders LEFT OUTER JOIN "
                     "(order_items AS order_items_1 "
                     "JOIN items AS items_1 "
@@ -2309,36 +2308,36 @@ class RelationshipCriteriaTest(_Fixtures, testing.AssertsCompiledSQL):
                     "SELECT users.id, users.name FROM users ORDER BY users.id"
                 ),
                 CompiledSQL(
-                    "SELECT addresses.id AS addresses_id, "
-                    "addresses.user_id AS addresses_user_id, "
-                    "addresses.email_address AS addresses_email_address "
+                    "SELECT addresses.id, "
+                    "addresses.user_id, "
+                    "addresses.email_address "
                     "FROM addresses WHERE :param_1 = addresses.user_id "
                     "AND addresses.email_address != :email_address_1 "
                     "ORDER BY addresses.id",
                     [{"param_1": 7, "email_address_1": value}],
                 ),
                 CompiledSQL(
-                    "SELECT addresses.id AS addresses_id, "
-                    "addresses.user_id AS addresses_user_id, "
-                    "addresses.email_address AS addresses_email_address "
+                    "SELECT addresses.id, "
+                    "addresses.user_id, "
+                    "addresses.email_address "
                     "FROM addresses WHERE :param_1 = addresses.user_id "
                     "AND addresses.email_address != :email_address_1 "
                     "ORDER BY addresses.id",
                     [{"param_1": 8, "email_address_1": value}],
                 ),
                 CompiledSQL(
-                    "SELECT addresses.id AS addresses_id, "
-                    "addresses.user_id AS addresses_user_id, "
-                    "addresses.email_address AS addresses_email_address "
+                    "SELECT addresses.id, "
+                    "addresses.user_id, "
+                    "addresses.email_address "
                     "FROM addresses WHERE :param_1 = addresses.user_id "
                     "AND addresses.email_address != :email_address_1 "
                     "ORDER BY addresses.id",
                     [{"param_1": 9, "email_address_1": value}],
                 ),
                 CompiledSQL(
-                    "SELECT addresses.id AS addresses_id, "
-                    "addresses.user_id AS addresses_user_id, "
-                    "addresses.email_address AS addresses_email_address "
+                    "SELECT addresses.id, "
+                    "addresses.user_id, "
+                    "addresses.email_address "
                     "FROM addresses WHERE :param_1 = addresses.user_id "
                     "AND addresses.email_address != :email_address_1 "
                     "ORDER BY addresses.id",
index 3bfb9b06bfa17643941ae5756101d40f6209225d..f610860d5d630d317f26af22bdd432c5c33fa3b2 100644 (file)
@@ -4858,7 +4858,7 @@ class SecondaryNestedJoinTest(
             testing.db,
             go,
             CompiledSQL(
-                "SELECT d.id AS d_id, d.name AS d_name FROM b "
+                "SELECT d.id, d.name FROM b "
                 "JOIN d ON b.d_id = d.id JOIN c ON c.d_id = d.id "
                 "WHERE :param_1 = b.id AND :param_2 = c.a_id "
                 "AND d.id = b.d_id",
@@ -6674,7 +6674,7 @@ class SecondaryIncludesLocalColsTest(fixtures.MappedTest):
                 params=[{"id_1": 2}],
             ),
             CompiledSQL(
-                "SELECT a_1.id AS a_1_id, b.id AS b_id FROM a AS a_1 JOIN "
+                "SELECT a_1.id, b.id FROM a AS a_1 JOIN "
                 "(SELECT a.id AS aid, b.id AS id FROM a JOIN b ON a.b_ids "
                 "LIKE (:id_1 || b.id || :param_1)) AS anon_1 "
                 "ON a_1.id = anon_1.aid JOIN b ON b.id = anon_1.id "
index c29da9f87c07f7ad995c32c6b23d1d0e77a2c9ea..9623cf0fae4229b05d1bfec821a2bd354f921de7 100644 (file)
@@ -1873,9 +1873,9 @@ class BaseRelationFromJoinedSubclassTest(_Polymorphic):
                 {"primary_language_1": "java"},
             ),
             CompiledSQL(
-                "SELECT paperwork.person_id AS paperwork_person_id, "
-                "paperwork.paperwork_id AS paperwork_paperwork_id, "
-                "paperwork.description AS paperwork_description "
+                "SELECT paperwork.person_id, "
+                "paperwork.paperwork_id, "
+                "paperwork.description "
                 "FROM paperwork WHERE paperwork.person_id "
                 "IN (__[POSTCOMPILE_primary_keys]) "
                 "ORDER BY paperwork.paperwork_id",
@@ -1923,9 +1923,9 @@ class BaseRelationFromJoinedSubclassTest(_Polymorphic):
                 },
             ),
             CompiledSQL(
-                "SELECT paperwork.person_id AS paperwork_person_id, "
-                "paperwork.paperwork_id AS paperwork_paperwork_id, "
-                "paperwork.description AS paperwork_description "
+                "SELECT paperwork.person_id, "
+                "paperwork.paperwork_id, "
+                "paperwork.description "
                 "FROM paperwork WHERE paperwork.person_id "
                 "IN (__[POSTCOMPILE_primary_keys]) "
                 "ORDER BY paperwork.paperwork_id",
@@ -1969,9 +1969,9 @@ class BaseRelationFromJoinedSubclassTest(_Polymorphic):
                 "DESC LIMIT :param_1"
             ),
             CompiledSQL(
-                "SELECT paperwork.person_id AS paperwork_person_id, "
-                "paperwork.paperwork_id AS paperwork_paperwork_id, "
-                "paperwork.description AS paperwork_description "
+                "SELECT paperwork.person_id, "
+                "paperwork.paperwork_id, "
+                "paperwork.description "
                 "FROM paperwork WHERE paperwork.person_id "
                 "IN (__[POSTCOMPILE_primary_keys]) "
                 "ORDER BY paperwork.paperwork_id",
@@ -2023,9 +2023,9 @@ class BaseRelationFromJoinedSubclassTest(_Polymorphic):
                 "LIMIT :param_1"
             ),
             CompiledSQL(
-                "SELECT paperwork.person_id AS paperwork_person_id, "
-                "paperwork.paperwork_id AS paperwork_paperwork_id, "
-                "paperwork.description AS paperwork_description "
+                "SELECT paperwork.person_id, "
+                "paperwork.paperwork_id, "
+                "paperwork.description "
                 "FROM paperwork WHERE paperwork.person_id "
                 "IN (__[POSTCOMPILE_primary_keys]) "
                 "ORDER BY paperwork.paperwork_id",
@@ -2071,9 +2071,9 @@ class BaseRelationFromJoinedSubclassTest(_Polymorphic):
                 "ORDER BY engineers_1.primary_language DESC LIMIT :param_1"
             ),
             CompiledSQL(
-                "SELECT paperwork.person_id AS paperwork_person_id, "
-                "paperwork.paperwork_id AS paperwork_paperwork_id, "
-                "paperwork.description AS paperwork_description "
+                "SELECT paperwork.person_id, "
+                "paperwork.paperwork_id, "
+                "paperwork.description "
                 "FROM paperwork WHERE paperwork.person_id "
                 "IN (__[POSTCOMPILE_primary_keys]) "
                 "ORDER BY paperwork.paperwork_id",
@@ -2293,7 +2293,7 @@ class TupleTest(fixtures.DeclarativeMappedTest):
                 {},
             ),
             CompiledSQL(
-                "SELECT b.a_id1 AS b_a_id1, b.a_id2 AS b_a_id2, b.id AS b_id "
+                "SELECT b.a_id1, b.a_id2, b.id "
                 "FROM b WHERE (b.a_id1, b.a_id2) IN "
                 "(__[POSTCOMPILE_primary_keys]) ORDER BY b.id",
                 [{"primary_keys": [(i, i + 2) for i in range(1, 20)]}],
@@ -2325,7 +2325,7 @@ class TupleTest(fixtures.DeclarativeMappedTest):
                 {},
             ),
             CompiledSQL(
-                "SELECT a.id1 AS a_id1, a.id2 AS a_id2 FROM a "
+                "SELECT a.id1, a.id2 FROM a "
                 "WHERE (a.id1, a.id2) IN (__[POSTCOMPILE_primary_keys])",
                 [{"primary_keys": [(i, i + 2) for i in range(1, 20)]}],
             ),
@@ -2398,19 +2398,19 @@ class ChunkingTest(fixtures.DeclarativeMappedTest):
             go,
             CompiledSQL("SELECT a.id AS a_id FROM a ORDER BY a.id", {}),
             CompiledSQL(
-                "SELECT b.a_id AS b_a_id, b.id AS b_id "
+                "SELECT b.a_id, b.id "
                 "FROM b WHERE b.a_id IN "
                 "(__[POSTCOMPILE_primary_keys]) ORDER BY b.id",
                 {"primary_keys": list(range(1, 48))},
             ),
             CompiledSQL(
-                "SELECT b.a_id AS b_a_id, b.id AS b_id "
+                "SELECT b.a_id, b.id "
                 "FROM b WHERE b.a_id IN "
                 "(__[POSTCOMPILE_primary_keys]) ORDER BY b.id",
                 {"primary_keys": list(range(48, 95))},
             ),
             CompiledSQL(
-                "SELECT b.a_id AS b_a_id, b.id AS b_id "
+                "SELECT b.a_id, b.id "
                 "FROM b WHERE b.a_id IN "
                 "(__[POSTCOMPILE_primary_keys]) ORDER BY b.id",
                 {"primary_keys": list(range(95, 101))},
@@ -2474,19 +2474,19 @@ class ChunkingTest(fixtures.DeclarativeMappedTest):
             ),
             # chunk size is 47.  so first chunk are a 1->47...
             CompiledSQL(
-                "SELECT a.id AS a_id FROM a WHERE a.id IN "
+                "SELECT a.id FROM a WHERE a.id IN "
                 "(__[POSTCOMPILE_primary_keys])",
                 {"primary_keys": list(range(1, 48))},
             ),
             # second chunk is a 48-94
             CompiledSQL(
-                "SELECT a.id AS a_id FROM a WHERE a.id IN "
+                "SELECT a.id FROM a WHERE a.id IN "
                 "(__[POSTCOMPILE_primary_keys])",
                 {"primary_keys": list(range(48, 95))},
             ),
             # third and final chunk 95-100.
             CompiledSQL(
-                "SELECT a.id AS a_id FROM a WHERE a.id IN "
+                "SELECT a.id FROM a WHERE a.id IN "
                 "(__[POSTCOMPILE_primary_keys])",
                 {"primary_keys": list(range(95, 101))},
             ),
@@ -3011,15 +3011,14 @@ class SelfRefInheritanceAliasedTest(
                     [{"id_1": 2}],
                 ),
                 CompiledSQL(
-                    "SELECT foo_1.id AS foo_1_id, "
-                    "foo_1.type AS foo_1_type, foo_1.foo_id AS foo_1_foo_id "
+                    "SELECT foo_1.id, foo_1.type, foo_1.foo_id "
                     "FROM foo AS foo_1 "
                     "WHERE foo_1.id IN (__[POSTCOMPILE_primary_keys])",
                     {"primary_keys": [3]},
                 ),
                 CompiledSQL(
-                    "SELECT foo.id AS foo_id_1, foo.type AS foo_type, "
-                    "foo.foo_id AS foo_foo_id FROM foo "
+                    "SELECT foo.id, foo.type, "
+                    "foo.foo_id FROM foo "
                     "WHERE foo.id IN (__[POSTCOMPILE_primary_keys])",
                     {"primary_keys": [1]},
                 ),
@@ -3188,7 +3187,7 @@ class SingleInhSubclassTest(
                 {"type_1": ["employer"]},
             ),
             CompiledSQL(
-                "SELECT role.user_id AS role_user_id, role.id AS role_id "
+                "SELECT role.user_id, role.id "
                 "FROM role WHERE role.user_id "
                 "IN (__[POSTCOMPILE_primary_keys])",
                 {"primary_keys": [1]},
@@ -3312,7 +3311,7 @@ class M2OWDegradeTest(
                 [{"id_1": [1, 3]}],
             ),
             CompiledSQL(
-                "SELECT b.id AS b_id, b.x AS b_x, b.y AS b_y "
+                "SELECT b.id, b.x, b.y "
                 "FROM b WHERE b.id IN (__[POSTCOMPILE_primary_keys])",
                 [{"primary_keys": [1, 2]}],
             ),
@@ -3345,8 +3344,7 @@ class M2OWDegradeTest(
             # emit either for each parent object individually, or as a second
             # query for them.
             CompiledSQL(
-                "SELECT a_1.id AS a_1_id, b.id AS b_id, b.x AS b_x, "
-                "b.y AS b_y "
+                "SELECT a_1.id, b.id, b.x, b.y "
                 "FROM a AS a_1 JOIN b ON b.id = a_1.b_id "
                 "WHERE a_1.id IN (__[POSTCOMPILE_primary_keys])",
                 [{"primary_keys": [1, 3]}],
@@ -3371,7 +3369,7 @@ class M2OWDegradeTest(
                 [{}],
             ),
             CompiledSQL(
-                "SELECT b.id AS b_id, b.x AS b_x, b.y AS b_y "
+                "SELECT b.id, b.x, b.y "
                 "FROM b WHERE b.id IN (__[POSTCOMPILE_primary_keys])",
                 [{"primary_keys": [1, 2]}],
             ),
@@ -3402,8 +3400,8 @@ class M2OWDegradeTest(
                 [{}],
             ),
             CompiledSQL(
-                "SELECT a_1.id AS a_1_id, b.id AS b_id, b.x AS b_x, "
-                "b.y AS b_y FROM a AS a_1 JOIN b ON b.id = a_1.b_id "
+                "SELECT a_1.id, b.id, b.x, b.y "
+                "FROM a AS a_1 JOIN b ON b.id = a_1.b_id "
                 "WHERE a_1.id IN (__[POSTCOMPILE_primary_keys])",
                 [{"primary_keys": [1, 2, 3, 4, 5]}],
             ),
@@ -3436,8 +3434,7 @@ class M2OWDegradeTest(
             # emit either for each parent object individually, or as a second
             # query for them.
             CompiledSQL(
-                "SELECT a_1.id AS a_1_id, b.id AS b_id, b.x AS b_x, "
-                "b.y AS b_y "
+                "SELECT a_1.id, b.id, b.x, b.y "
                 "FROM a AS a_1 JOIN b ON b.id = a_1.b_id "
                 "WHERE a_1.id IN (__[POSTCOMPILE_primary_keys])",
                 [{"primary_keys": [1, 2, 3, 4, 5]}],
@@ -3549,15 +3546,15 @@ class SameNamePolymorphicTest(fixtures.DeclarativeMappedTest):
             ),
             AllOf(
                 CompiledSQL(
-                    "SELECT child_a.parent_id AS child_a_parent_id, "
-                    "child_a.id AS child_a_id FROM child_a "
+                    "SELECT child_a.parent_id, "
+                    "child_a.id FROM child_a "
                     "WHERE child_a.parent_id IN "
                     "(__[POSTCOMPILE_primary_keys])",
                     [{"primary_keys": [1]}],
                 ),
                 CompiledSQL(
-                    "SELECT child_b.parent_id AS child_b_parent_id, "
-                    "child_b.id AS child_b_id FROM child_b "
+                    "SELECT child_b.parent_id, "
+                    "child_b.id FROM child_b "
                     "WHERE child_b.parent_id IN "
                     "(__[POSTCOMPILE_primary_keys])",
                     [{"primary_keys": [2]}],
index 4b839d8efca46d721ac20d244a0d21e7d45f3aac..b3c6f5877522f4f8db9d677e19c8416d49680f86 100644 (file)
@@ -147,9 +147,9 @@ class EagerTest(_fixtures.FixtureTest, testing.AssertsCompiledSQL):
             # issue 7505
             # subqueryload degrades for a from_statement.  this is a lazyload
             CompiledSQL(
-                "SELECT addresses.id AS addresses_id, addresses.user_id AS "
-                "addresses_user_id, addresses.email_address AS "
-                "addresses_email_address FROM addresses "
+                "SELECT addresses.id, addresses.user_id, "
+                "addresses.email_address "
+                "FROM addresses "
                 "WHERE :param_1 = addresses.user_id ORDER BY addresses.id",
                 [{"param_1": 7}],
             ),
index 90ea0eaa039ec86680174e71fbaaf98fc1edc4ef..af6f0c2ce7b10822c728f7846a4b840e791c4ebb 100644 (file)
@@ -381,25 +381,23 @@ class RudimentaryFlushTest(UOWTest):
                 # the User row might be handled before or the addresses
                 # are loaded so need to use AllOf
                 CompiledSQL(
-                    "SELECT addresses.id AS addresses_id, "
-                    "addresses.user_id AS "
-                    "addresses_user_id, addresses.email_address AS "
-                    "addresses_email_address FROM addresses "
+                    "SELECT addresses.id, addresses.user_id, "
+                    "addresses.email_address "
+                    "FROM addresses "
                     "WHERE addresses.id = "
                     ":pk_1",
                     lambda ctx: {"pk_1": c1id},
                 ),
                 CompiledSQL(
-                    "SELECT addresses.id AS addresses_id, "
-                    "addresses.user_id AS "
-                    "addresses_user_id, addresses.email_address AS "
-                    "addresses_email_address FROM addresses "
+                    "SELECT addresses.id, addresses.user_id, "
+                    "addresses.email_address "
+                    "FROM addresses "
                     "WHERE addresses.id = "
                     ":pk_1",
                     lambda ctx: {"pk_1": c2id},
                 ),
                 CompiledSQL(
-                    "SELECT users.id AS users_id, users.name AS users_name "
+                    "SELECT users.id, users.name "
                     "FROM users WHERE users.id = :pk_1",
                     lambda ctx: {"pk_1": pid},
                 ),
@@ -457,19 +455,17 @@ class RudimentaryFlushTest(UOWTest):
                 # relationship is simple m2o, no SELECT should be emitted for
                 # it.
                 CompiledSQL(
-                    "SELECT addresses.id AS addresses_id, "
-                    "addresses.user_id AS "
-                    "addresses_user_id, addresses.email_address AS "
-                    "addresses_email_address FROM addresses "
+                    "SELECT addresses.id, addresses.user_id, "
+                    "addresses.email_address "
+                    "FROM addresses "
                     "WHERE addresses.id = "
                     ":pk_1",
                     lambda ctx: {"pk_1": c1id},
                 ),
                 CompiledSQL(
-                    "SELECT addresses.id AS addresses_id, "
-                    "addresses.user_id AS "
-                    "addresses_user_id, addresses.email_address AS "
-                    "addresses_email_address FROM addresses "
+                    "SELECT addresses.id, addresses.user_id, "
+                    "addresses.email_address "
+                    "FROM addresses "
                     "WHERE addresses.id = "
                     ":pk_1",
                     lambda ctx: {"pk_1": c2id},
@@ -523,19 +519,17 @@ class RudimentaryFlushTest(UOWTest):
             AllOf(
                 # the parent User is expired, so it gets loaded here.
                 CompiledSQL(
-                    "SELECT addresses.id AS addresses_id, "
-                    "addresses.user_id AS "
-                    "addresses_user_id, addresses.email_address AS "
-                    "addresses_email_address FROM addresses "
+                    "SELECT addresses.id, addresses.user_id, "
+                    "addresses.email_address "
+                    "FROM addresses "
                     "WHERE addresses.id = "
                     ":pk_1",
                     lambda ctx: {"pk_1": c1id},
                 ),
                 CompiledSQL(
-                    "SELECT addresses.id AS addresses_id, "
-                    "addresses.user_id AS "
-                    "addresses_user_id, addresses.email_address AS "
-                    "addresses_email_address FROM addresses "
+                    "SELECT addresses.id, addresses.user_id, "
+                    "addresses.email_address "
+                    "FROM addresses "
                     "WHERE addresses.id = "
                     ":pk_1",
                     lambda ctx: {"pk_1": c2id},
@@ -854,8 +848,7 @@ class RaiseLoadIgnoredTest(
             sess.flush,
             # for the flush process, lazy="raise" is ignored
             CompiledSQL(
-                "SELECT b.id AS b_id, b.a_id AS b_a_id FROM b "
-                "WHERE :param_1 = b.a_id",
+                "SELECT b.id, b.a_id FROM b WHERE :param_1 = b.a_id",
                 [{"param_1": 1}],
             ),
             CompiledSQL(
@@ -1313,23 +1306,20 @@ class SingleCycleTest(UOWTest):
                 # the selects here are in fact unexpiring
                 # each row - the m2o comes from the identity map.
                 CompiledSQL(
-                    "SELECT nodes.id AS nodes_id, nodes.parent_id AS "
-                    "nodes_parent_id, "
-                    "nodes.data AS nodes_data FROM nodes "
+                    "SELECT nodes.id, nodes.parent_id, nodes.data "
+                    "FROM nodes "
                     "WHERE nodes.id = :pk_1",
                     lambda ctx: {"pk_1": pid},
                 ),
                 CompiledSQL(
-                    "SELECT nodes.id AS nodes_id, nodes.parent_id AS "
-                    "nodes_parent_id, "
-                    "nodes.data AS nodes_data FROM nodes "
+                    "SELECT nodes.id, nodes.parent_id, nodes.data "
+                    "FROM nodes "
                     "WHERE nodes.id = :pk_1",
                     lambda ctx: {"pk_1": c1id},
                 ),
                 CompiledSQL(
-                    "SELECT nodes.id AS nodes_id, nodes.parent_id AS "
-                    "nodes_parent_id, "
-                    "nodes.data AS nodes_data FROM nodes "
+                    "SELECT nodes.id, nodes.parent_id, nodes.data "
+                    "FROM nodes "
                     "WHERE nodes.id = :pk_1",
                     lambda ctx: {"pk_1": c2id},
                 ),
@@ -1510,8 +1500,8 @@ class SingleCycleM2MTest(
                 # this is n1.parents firing off, as it should, since
                 # passive_deletes is False for n1.parents
                 CompiledSQL(
-                    "SELECT nodes.id AS nodes_id, nodes.data AS nodes_data, "
-                    "nodes.favorite_node_id AS nodes_favorite_node_id FROM "
+                    "SELECT nodes.id, nodes.data, "
+                    "nodes.favorite_node_id FROM "
                     "nodes, node_to_nodes WHERE :param_1 = "
                     "node_to_nodes.right_node_id AND nodes.id = "
                     "node_to_nodes.left_node_id",
@@ -2506,14 +2496,12 @@ class EagerDefaultsTest(fixtures.MappedTest):
                     enable_returning=False,
                 ),
                 CompiledSQL(
-                    "SELECT test.foo AS test_foo FROM test "
-                    "WHERE test.id = :pk_1",
+                    "SELECT test.foo FROM test WHERE test.id = :pk_1",
                     [{"pk_1": 1}],
                     enable_returning=False,
                 ),
                 CompiledSQL(
-                    "SELECT test.foo AS test_foo FROM test "
-                    "WHERE test.id = :pk_1",
+                    "SELECT test.foo FROM test WHERE test.id = :pk_1",
                     [{"pk_1": 2}],
                     enable_returning=False,
                 ),
@@ -2574,13 +2562,11 @@ class EagerDefaultsTest(fixtures.MappedTest):
                         [{"id": 1}, {"id": 2}],
                     ),
                     CompiledSQL(
-                        "SELECT test.foo AS test_foo FROM test "
-                        "WHERE test.id = :pk_1",
+                        "SELECT test.foo FROM test WHERE test.id = :pk_1",
                         [{"pk_1": 1}],
                     ),
                     CompiledSQL(
-                        "SELECT test.foo AS test_foo FROM test "
-                        "WHERE test.id = :pk_1",
+                        "SELECT test.foo FROM test WHERE test.id = :pk_1",
                         [{"pk_1": 2}],
                     ),
                 ],
@@ -2640,12 +2626,12 @@ class EagerDefaultsTest(fixtures.MappedTest):
                         ],
                     ),
                     CompiledSQL(
-                        "SELECT test3.foo AS test3_foo "
+                        "SELECT test3.foo "
                         "FROM test3 WHERE test3.id = :pk_1",
                         [{"pk_1": 1}],
                     ),
                     CompiledSQL(
-                        "SELECT test3.foo AS test3_foo "
+                        "SELECT test3.foo "
                         "FROM test3 WHERE test3.id = :pk_1",
                         [{"pk_1": 2}],
                     ),
@@ -2731,12 +2717,12 @@ class EagerDefaultsTest(fixtures.MappedTest):
                         enable_returning=False,
                     ),
                     CompiledSQL(
-                        "SELECT test2.bar AS test2_bar FROM test2 "
+                        "SELECT test2.bar FROM test2 "
                         "WHERE test2.id = :pk_1",
                         [{"pk_1": 1}],
                     ),
                     CompiledSQL(
-                        "SELECT test2.bar AS test2_bar FROM test2 "
+                        "SELECT test2.bar FROM test2 "
                         "WHERE test2.id = :pk_1",
                         [{"pk_1": 3}],
                     ),
@@ -2830,13 +2816,13 @@ class EagerDefaultsTest(fixtures.MappedTest):
                         enable_returning=False,
                     ),
                     CompiledSQL(
-                        "SELECT test4.bar AS test4_bar FROM test4 "
+                        "SELECT test4.bar FROM test4 "
                         "WHERE test4.id = :pk_1",
                         [{"pk_1": 1}],
                         enable_returning=False,
                     ),
                     CompiledSQL(
-                        "SELECT test4.bar AS test4_bar FROM test4 "
+                        "SELECT test4.bar FROM test4 "
                         "WHERE test4.id = :pk_1",
                         [{"pk_1": 3}],
                         enable_returning=False,
@@ -2934,18 +2920,15 @@ class EagerDefaultsTest(fixtures.MappedTest):
                     enable_returning=False,
                 ),
                 CompiledSQL(
-                    "SELECT test2.bar AS test2_bar FROM test2 "
-                    "WHERE test2.id = :pk_1",
+                    "SELECT test2.bar FROM test2 WHERE test2.id = :pk_1",
                     [{"pk_1": 1}],
                 ),
                 CompiledSQL(
-                    "SELECT test2.bar AS test2_bar FROM test2 "
-                    "WHERE test2.id = :pk_1",
+                    "SELECT test2.bar FROM test2 WHERE test2.id = :pk_1",
                     [{"pk_1": 3}],
                 ),
                 CompiledSQL(
-                    "SELECT test2.bar AS test2_bar FROM test2 "
-                    "WHERE test2.id = :pk_1",
+                    "SELECT test2.bar FROM test2 WHERE test2.id = :pk_1",
                     [{"pk_1": 4}],
                 ),
             )
@@ -3124,7 +3107,7 @@ class EagerDefaultsTest(fixtures.MappedTest):
                         [{"id": 1, "bar": 5}],
                     ),
                     CompiledSQL(
-                        "SELECT anon_1.foo AS anon_1_foo FROM "
+                        "SELECT anon_1.foo FROM "
                         "(SELECT test.id AS id, test.foo AS foo, "
                         "test2.id AS id2, test2.bar AS bar FROM test "
                         "JOIN test2 ON test.foo = test2.foo) AS anon_1 "
@@ -3268,12 +3251,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}],
                             ),
@@ -3388,12 +3371,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}],
                             ),
@@ -3464,12 +3447,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}],
                             ),
index 06fb1b2a5fc8482d5352cd7578e829ef1f1dec0f..d239869a4e0c2434ebca2ebd6626a2426f7d1ef8 100644 (file)
@@ -1421,7 +1421,6 @@ class ServerVersioningTest(fixtures.MappedTest):
             statements.append(
                 CompiledSQL(
                     "SELECT version_table.version_id "
-                    "AS version_table_version_id "
                     "FROM version_table WHERE version_table.id = :pk_1",
                     lambda ctx: [{"pk_1": 1}],
                 )
@@ -1479,7 +1478,6 @@ class ServerVersioningTest(fixtures.MappedTest):
                 ),
                 CompiledSQL(
                     "SELECT version_table.version_id "
-                    "AS version_table_version_id "
                     "FROM version_table WHERE version_table.id = :pk_1",
                     lambda ctx: [{"pk_1": 1}],
                 ),
@@ -1630,19 +1628,16 @@ class ServerVersioningTest(fixtures.MappedTest):
                 ),
                 CompiledSQL(
                     "SELECT version_table.version_id "
-                    "AS version_table_version_id "
                     "FROM version_table WHERE version_table.id = :pk_1",
                     lambda ctx: [{"pk_1": 1}],
                 ),
                 CompiledSQL(
                     "SELECT version_table.version_id "
-                    "AS version_table_version_id "
                     "FROM version_table WHERE version_table.id = :pk_1",
                     lambda ctx: [{"pk_1": 2}],
                 ),
                 CompiledSQL(
                     "SELECT version_table.version_id "
-                    "AS version_table_version_id "
                     "FROM version_table WHERE version_table.id = :pk_1",
                     lambda ctx: [{"pk_1": 3}],
                 ),
index c50e01ce3010c8776e71d73e6379fc47829035bf..50da808a172c03d6721ce04255fbd71a6eb1c9f1 100644 (file)
@@ -387,9 +387,9 @@ test.aaa_profiling.test_orm.MergeBackrefsTest.test_merge_pending_with_all_pks x8
 
 # TEST: test.aaa_profiling.test_orm.MergeTest.test_merge_load
 
-test.aaa_profiling.test_orm.MergeTest.test_merge_load x86_64_linux_cpython_3.13_sqlite_pysqlite_dbapiunicode_cextensions 1491
+test.aaa_profiling.test_orm.MergeTest.test_merge_load x86_64_linux_cpython_3.13_sqlite_pysqlite_dbapiunicode_cextensions 1332
 test.aaa_profiling.test_orm.MergeTest.test_merge_load x86_64_linux_cpython_3.13_sqlite_pysqlite_dbapiunicode_nocextensions 1603
-test.aaa_profiling.test_orm.MergeTest.test_merge_load x86_64_linux_cpython_3.14_sqlite_pysqlite_dbapiunicode_cextensions 1492
+test.aaa_profiling.test_orm.MergeTest.test_merge_load x86_64_linux_cpython_3.14_sqlite_pysqlite_dbapiunicode_cextensions 1333
 test.aaa_profiling.test_orm.MergeTest.test_merge_load x86_64_linux_cpython_3.14_sqlite_pysqlite_dbapiunicode_nocextensions 1604
 
 # TEST: test.aaa_profiling.test_orm.MergeTest.test_merge_no_load