0

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.

Ilja Everilä
  • 50,538
  • 7
  • 126
  • 127
caliph
  • 1,389
  • 3
  • 27
  • 52

0 Answers0