Fix sqlalchemy grouping on v1 storage
This fixes "CompileError: Can't resolve label reference for ORDER BY / GROUP BY." error messages raised by sqlalchemy when the groupby expression includes a comma. Change-Id: Ia253175b45b8222aaee415ea535fa4102312be5a
This commit is contained in:
@@ -119,7 +119,7 @@ class SQLAlchemyStorage(storage.BaseStorage):
|
|||||||
self.frame_model.end <= end,
|
self.frame_model.end <= end,
|
||||||
self.frame_model.res_type != '_NO_DATA_')
|
self.frame_model.res_type != '_NO_DATA_')
|
||||||
if groupby:
|
if groupby:
|
||||||
q = q.group_by(groupby)
|
q = q.group_by(sqlalchemy.sql.text(groupby))
|
||||||
|
|
||||||
# Order by sum(rate)
|
# Order by sum(rate)
|
||||||
q = q.order_by(sqlalchemy.func.sum(self.frame_model.rate))
|
q = q.order_by(sqlalchemy.func.sum(self.frame_model.rate))
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
``CompileError: Can't resolve label reference for ORDER BY / GROUP BY.``
|
||||||
|
errors that were sometimes raised by SQLAlchemy when using the v1 storage
|
||||||
|
backend and grouping on ``tenant_id`` and ``res_type`` have been fixed.
|
||||||
Reference in New Issue
Block a user