Created
June 14, 2017 18:36
-
-
Save KMoon01/d82324594c975104c763140a54133565 to your computer and use it in GitHub Desktop.
Query from an EMS event database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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