skip to Main Content

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()…

VIEW QUESTION

postgresql join query matching null

I can't make a request. I have 3 tables. I would like to have the following result: services id name 1 service1 2 service2 settings id name default_value 1 setting1 10 2 setting2 false services_settings id service_id setting_id value 1…

VIEW QUESTION
Back To Top
Search