Skip to content

Instantly share code, notes, and snippets.

@ldenson11
Created October 28, 2019 17:32
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/be1e7b2e1e7e96f32394b965d6a5b8d8 to your computer and use it in GitHub Desktop.
Save ldenson11/be1e7b2e1e7e96f32394b965d6a5b8d8 to your computer and use it in GitHub Desktop.
-- find aircraft that have been flagged for further scrutiny
SELECT a.icao, a.lat, a.lon, a.type_aircraft, a.type_registrant
FROM airplanes a, -- virtual table for aircraft ADS-B cluster
airplanes_alert_notifications b -- virtual table for notifications cluster
WHERE a.icao = b.icao
AND a.eventTimestamp -- kafka timestamp
BETWEEN current_timestamp - INTERVAL '5' HOUR
AND current_timestamp -- last 5 hours of data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment