rony rony - 7 months ago 11
SQL Question

Is it possible to reset group_by items of a sqlalchemy query object in python?

I have a

sqlalchemy
query object which contains some
group_by
items added earlier using the
query.group_by()
method. I want to reset those items and add new
group_by
items. Is it possible? If so then please find me the way.

rmn rmn
Answer

The group_by columns are stored in _group_by property of the query object. You can set it to False or empty list []:

query._group_by = False

or

query._group_by = []