Skip to content

Instantly share code, notes, and snippets.

@ldenson11
Created January 29, 2020 22:06
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/dc9ab2ffd67b9d591ab651a9de225b17 to your computer and use it in GitHub Desktop.
Save ldenson11/dc9ab2ffd67b9d591ab651a9de225b17 to your computer and use it in GitHub Desktop.
-- detect multiple large transactions within an 15m period
-- send to alerting framework
SELECT card, userid
TUMBLE_END(eventTimestamp, interval '15' minute) as ts
FROM auths
WHERE amount > 10000 -- large transaction
GROUP BY card, userid, TUMBLE(eventTimestamp, interval '15' minute)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment