我想将PostgreSQL查询转换为烧瓶SQL炼金术:
PostgreSQL查询:
select event_data.location_id,
event_data.job_id, event_data.area_id,
min(temperature) as min_temp,
max(temperature) as max_temp, min(humidity) as min_humidity, max(humidity) as max_humidity,
(date_trunc('month', payload_time)::date) as from_date,
((date_trunc('month', payload_time) + '1 Month - 1 day' ) ::date) as to_date,
min(airpressure) as min_pressure, max(airpressure) as max_pressure from eco_event_data_log
where area_id =27 group by location_id, job_id, area_id, from_date, to_date;