mirror of
https://github.com/sqlalchemy/sqlalchemy.git
synced 2026-05-09 10:20:00 -04:00
- add logic to compiler such that if stack is empty, we just
stringify a _label_reference() as is. - add .key to _label_reference(), so that when _make_proxy() is called, we don't call str() on it anyway. - add a test to exercise Query's behavior of adding all the order_by expressions to the columns list of the select, assert that things work out when we have a _label_reference there, that it gets sucked into the columns list and spit out on the other side, it's referred to appropriately, etc. _label_reference() could theoretically be resolved at the point we iterate _raw_columns() but it's better to just let things work as they already do (except nicer, since we get "tablename.colname" instead of just "somename" in the columns list) so that we aren't adding a ton of overhead to _columns_plus_names in the common case.
This commit is contained in:
@@ -674,3 +674,8 @@ class OrderByLabelResolutionTest(fixtures.TestBase, AssertsCompiledSQL):
|
||||
"SELECT foo(:foo_1) AS x UNION SELECT foo(:foo_2) AS y ORDER BY x"
|
||||
)
|
||||
|
||||
def test_standalone_units_stringable(self):
|
||||
self.assert_compile(
|
||||
desc("somelabel"),
|
||||
"somelabel DESC"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user