summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/assertsql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-08-27 17:08:11 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2019-08-28 17:11:15 -0400
commit3bb402ff8ed980ae393def7462b1da49c0e0a8a7 (patch)
treeac4a0a3cfef40d785fecd79015f75caf51054070 /lib/sqlalchemy/testing/assertsql.py
parent5bf264ca08b8bb38d50baeb48fe1729da4164711 (diff)
downloadsqlalchemy-3bb402ff8ed980ae393def7462b1da49c0e0a8a7.tar.gz
Label simple column transformations as the column name
Additional logic has been added such that certain SQL expressions which typically wrap a single database column will use the name of that column as their "anonymous label" name within a SELECT statement, potentially making key-based lookups in result tuples more intutive. The primary example of this is that of a CAST expression, e.g. ``CAST(table.colname AS INTEGER)``, which will export its default name as "colname", rather than the usual "anon_1" label, that is, ``CAST(table.colname AS INTEGER) AS colname``. If the inner expression doesn't have a name, then the previous "anonymous label" logic is used. When using SELECT statements that make use of :meth:`.Select.apply_labels`, such as those emitted by the ORM, the labeling logic will produce ``<tablename>_<inner column name>`` in the same was as if the column were named alone. The logic applies right now to the :func:`.cast` and :func:`.type_coerce` constructs as well as some single-element boolean expressions. Fixes: #4449 Change-Id: Ie3b73470e3bea53f2386cd86514cdc556491564e
Diffstat (limited to 'lib/sqlalchemy/testing/assertsql.py')
0 files changed, 0 insertions, 0 deletions