Postgresql – SQLAlchemy – column must appear in the GROUP BY clause or be used in an aggregate function
I am using sqlalchemy with postgresql, Tables Shape[id, name, timestamp, user_id]#user_id referring id column in user table User[id, name] this query - query1 = self.session.query(Shape.timestamp, Shape.name, User.id, extract('day', Shape.timestamp).label('day'), extract('hour', Shape.timestamp).label('hour'), func.count(Shape.id).label("total"), ) .join(User, User.id==Shape.user_id) .filter(Shape.timestamp.between(from_datetime, to_datetime)) .group_by(Shape.user_id) .group_by('hour') .all()…