Last active
July 15, 2020 18:35
-
-
Save bitner/5a4e5b811871c969d2c37c4f3dca5b52 to your computer and use it in GitHub Desktop.
OpenAQ Data Compare Queries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- PostgreSQL | |
select | |
row_number() over (order by date_utc asc, location, parameter), | |
location, | |
value, | |
parameter, | |
country, | |
city, | |
date_utc | |
from measurements | |
where | |
date_utc between '2020-07-01T00:00:00Z' and '2020-07-07T00:00:00Z' | |
and location='Abbotsford' | |
order by date_utc asc, location, parameter; | |
-- Athena | |
SELECT location, | |
value, | |
parameter, | |
country, | |
city, | |
from_iso8601_timestamp(date.utc) as date_utc | |
FROM openaq | |
WHERE | |
location = 'Abbotsford' AND | |
from_iso8601_timestamp(date.utc) | |
BETWEEN from_iso8601_timestamp('2020-07-01T00:00:00Z') | |
AND from_iso8601_timestamp('2020-07-07T00:00:00Z') | |
ORDER BY from_iso8601_timestamp(date.utc) asc, lower(location), parameter | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment