Add deterministic column more aggressively
This commit is contained in:
@@ -8,6 +8,7 @@ Here you can see the full list of changes between each SQLAlchemy-Utils release.
|
|||||||
^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
- Added support for Column objects in get_mapper
|
- Added support for Column objects in get_mapper
|
||||||
|
- Made make_order_by_deterministic add deterministic column more aggressively
|
||||||
|
|
||||||
|
|
||||||
0.27.6 (2014-10-29)
|
0.27.6 (2014-10-29)
|
||||||
|
@@ -190,7 +190,7 @@ def make_order_by_deterministic(query):
|
|||||||
if has_unique_index(column):
|
if has_unique_index(column):
|
||||||
return query
|
return query
|
||||||
except TypeError:
|
except TypeError:
|
||||||
return query
|
pass
|
||||||
|
|
||||||
base_table = get_tables(query._entities[0])[0]
|
base_table = get_tables(query._entities[0])[0]
|
||||||
query = query.order_by(
|
query = query.order_by(
|
||||||
|
@@ -88,4 +88,4 @@ class TestMakeOrderByDeterministic(TestCase):
|
|||||||
alias = sa.orm.aliased(self.User.__table__)
|
alias = sa.orm.aliased(self.User.__table__)
|
||||||
query = self.session.query(alias).order_by(alias.c.name)
|
query = self.session.query(alias).order_by(alias.c.name)
|
||||||
query = make_order_by_deterministic(query)
|
query = make_order_by_deterministic(query)
|
||||||
assert str(query).endswith('ORDER BY user_1.name')
|
assert str(query).endswith('ORDER BY user_1.name, "user".id ASC')
|
||||||
|
Reference in New Issue
Block a user