Skip to content

Instantly share code, notes, and snippets.

@kgorman
Created October 25, 2019 15:39
Show Gist options
  • Save kgorman/e57324ae7afa5504b843039e758a05bd to your computer and use it in GitHub Desktop.
Save kgorman/e57324ae7afa5504b843039e758a05bd to your computer and use it in GitHub Desktop.
sample3.sql
-- eventTimestamp is the Kafka timestamp
-- as unix timestamp. Magically added to every schema.
SELECT max(eventTimestamp) FROM solar_inputs;
-- make it human readable
SELECT CAST(max(eventTimestamp) AS varchar) as TS FROM solar_inputs;
-- dete math with interval
SELECT * FROM payments
WHERE eventTimestamp > CURRENT_TIMESTAMP-interval '10' second;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment