I want aggregated results from my table and I want to aggregate based on an attribute in a json field.
I tried:
channel_raw = db.session.query(
Chathistory2.meta_json['channel'],
func.sum(Chathistory2.id).label('sum')
).filter().group_by(Chathistory2.meta_json['channel']).all()
Error:
sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) could not identify an equality operator for type json
Is it not possible to group by an attribute from a json field?
Thanks in advance.