Skip to content

Instantly share code, notes, and snippets.

@ldenson11
Created January 29, 2020 22:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ldenson11/1b5b6d9fbf2a8cfa31d9e45c13bb9e3a to your computer and use it in GitHub Desktop.
Save ldenson11/1b5b6d9fbf2a8cfa31d9e45c13bb9e3a to your computer and use it in GitHub Desktop.
-- aggregate transactions over time and for enterprise data Warehouse
-- use hourly because storage in EDW is expensive
SELECT
card,
amount,
userid,
eventTimestamp as transaction_time
FROM auths
GROUP BY TUMBLE(eventTimestamp, interval '1' hour)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment