Skip to content

Instantly share code, notes, and snippets.

@KMoon01
Created June 14, 2017 18:36
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 KMoon01/d82324594c975104c763140a54133565 to your computer and use it in GitHub Desktop.
Save KMoon01/d82324594c975104c763140a54133565 to your computer and use it in GitHub Desktop.
Query from an EMS event database
from emspy import Connection
from emspy.query import FltQuery
# fill up your credential
efoqa_usr = ''
efoqa_pwd = ''
http_proxy = ''
https_proxy = ''
print "Connecting to EMS API..."
c = Connection(efoqa_usr,efoqa_pwd,
proxies = {'http': http_proxy,
'https':https_proxy})
datafile = "event_test.db"
print "Instantiating query object..."
fq = FltQuery(c, "ems9", datafile)
# Add and load the database
fq.update_dbtree("fdw","apm events", "standard", "p0")
fq.set_database("p0: library flight safety events")
fq.generate_preset_fieldtree()
# Add your field subtree
fq.update_fieldtree("profile 0: event info")
fq.save_metadata()
# Query body
fq.select("flight record", "p1: event record", "flight date (exact)", "fleet")
fq.filter("'p1: event type'=='Go Around'")
fq.get_top(10)
flt = fq.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment