FlightAware Discussions

Query FlightXML with no code project

Not a FlightAware employee but I got to thinking… What if I could query FlightXML with SQL syntax. Some people on the forums – and also me – want to explore the API without having to write a bunch of code. I liked the idea so much I coded up an open source project hosted on GitHub that actually runs code like the below. It’s not a commercial product but for the FlightAware community.

Example 1

select *
from airportinfo
where airportCode = 'kaus'

Returns a table like:

airportCode latitude longitude location name timezone
kaus 30.194527 -97.669876 Austin, TX Austin-Bergstrom Intl :America/Chicago

Example 2

select e.ident,
    actualdeparturetime,
    filed_departuretime,
    estimatedarrivaltime,
    estimatedarrivaltime - UTC_TIMESTAMP() as timeLeft,
    originCity,
    destinationCity,
    latitude,
    longitude,
    altitude
from enroute e
join inflightinfo i on e.ident = i.ident
where airport = 'kaus' and actualdeparturetime != 0 and filter = 'airline'

returns

ident actualdeparturetime filed_departuretime estimatedarrivaltime timeLeft originCity destinationCity latitude longitude altitude
FDX741 2020-05-15 22:30 2020-05-15 21:30 2020-05-15 23:49 00.00:09 Memphis, TN Austin, TX 30.60367 -97.48218 81
SWA236 2020-05-15 21:31 2020-05-15 21:40 2020-05-15 23:58 00.00:18 Orlando, FL Austin, TX 30.33991 -96.81037 156
AAY1316 2020-05-15 21:42 2020-05-15 21:24 2020-05-16 00:07 00.00:27 Hebron, KY Austin, TX 32.17584 -96.07044 280

Try it out.

There is more examples in the editor. It has autocomplete and much of the FlightAwareXML 2 API implemented. Try the link below. The editor can also be run in docker (see below). If you enter your credentials the queries will actually run and the results will be shown (of course your account will be charged for the called APIs).

http://flightquery.bitsummation.com/

Run locally in Docker:

docker run -d -p 5001:80 --name flightquery bitsummation/flightquery

then

http://localhost:5001

Code here:

That’s a pretty clever idea, and I love that you’ve used docker for distributing it. We’ve also wondered whether there would be any interest in exposing FlightXML data via a Graph API like interface and what that would look like from a user’s perspective…

It’s nice to write simple queries and get results back without writing code. Makes exploring API much easier.

It allows people to post examples or answer questions with code snippets that anyone could run. Don’t have to worry about what low level JSON to post and error codes.

You could also technically mix v2 and v3 together (v3 not implemented yet).