Skip to content

Commit 0016d3d

Browse files
committed
Removed query
1 parent fb0ee0c commit 0016d3d

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

ingest/etl_process_measurements.sql

-22
Original file line numberDiff line numberDiff line change
@@ -377,28 +377,6 @@ SET datetime_last = GREATEST(sensors_rollup.datetime_last, EXCLUDED.datetime_las
377377
SET modified_on = now();
378378

379379

380-
381-
WITH inserted_hours AS (
382-
-- first we group things, adding an hour to make it time-ending after truncating
383-
SELECT datetime + '1h'::interval as datetime
384-
, utc_offset(datetime + '1h'::interval, tz.tzid) as tz_offset
385-
FROM measurements m
386-
JOIN sensors s ON (s.sensors_id = m.sensors_id)
387-
JOIN sensor_systems sy ON (s.sensor_systems_id = sy.sensor_systems_id)
388-
JOIN sensor_nodes sn ON (sy.sensor_nodes_id = sn.sensor_nodes_id)
389-
JOIN timezones tz ON (sn.timezones_id = tz.timezones_id)
390-
WHERE m.added_on > now() - '1h'::interval
391-
GROUP BY 1, 2
392-
)
393-
INSERT INTO hourly_data_queue (datetime, tz_offset)
394-
SELECT as_utc_hour(datetime, tz_offset), tz_offset
395-
FROM inserted_hours
396-
GROUP BY 1, 2
397-
ON CONFLICT (datetime, tz_offset) DO UPDATE
398-
SET modified_on = now();
399-
400-
401-
402380
--Update the export queue/logs to export these records
403381
--wrap it in a block just in case the database does not have this module installed
404382
--we subtract the second because the data is assumed to be time ending

0 commit comments

Comments
 (0)