-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquerying.py
More file actions
37 lines (26 loc) · 1020 Bytes
/
querying.py
File metadata and controls
37 lines (26 loc) · 1020 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
###########################################
#### EXAMPLE Querying USAGE ####
###########################################
from fortress_sdk import Buyer
###########################################
#### Buyer Interaction Flow ####
###########################################
api_key = "buyer_key" # get this from the fortress web dashboard
ip_addr = "127.0.0.1"
# Initialize a buyer instance
buyer = Buyer(api_key, ip_addr)
# Initiate a query
sql_query = "select count(*) as numpeople from public.condition_era_death"
result, accuracy = buyer.query(query=sql_query)
sql_query = "select count(*) as people_per_condition from person"
result, accuracy = buyer.query(query=sql_query)
# execution result and accuracy of the query
print(result)
print(accuracy)
# Pretty print query history
buyer.print_query_history()
# Print columns
print("-----------------------COLUMNS-----------------------")
columns = buyer.get_columns()
print(columns["PERSON"])
print(columns["PERSON_VISIT_OCCURRENCE"])