Skip to content

Commit

Permalink
Merge pull request #35 from bcgov/release/patch_1_8_2
Browse files Browse the repository at this point in the history
added etk query
  • Loading branch information
amlanc1 authored Nov 27, 2023
2 parents 5cf432a + 46686b8 commit d193888
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/commonutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ def split_etk_event_payloads(payload,eventtype):
geopayload={}
geopayload['business_id']=payload_dict['ticket_number']
geopayload=json.dumps(geopayload)
main_event = {}
main_event['ticket_number'] = payload_dict['ticket_number']
payload_dict = main_event
eventpayload=json.dumps(eventpayload)
return json.dumps(payload_dict),eventpayload,countspayload,geopayload

Expand Down
10 changes: 8 additions & 2 deletions src/reconfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,27 @@ def recondestination(dbclient,main_staging_collection,main_table_collection,reco
table_name=(lambda x: bi_geo_table if x['eventType']=='geolocation' else bi_table_name)(row)
# table_name = bi_table_name
reconqrystr = f'SELECT * FROM {table_name} WHERE {mainqrystr}'
logger.debug(f'here is the query string for main table: {reconqrystr}')
mainfound = bi_sql_db_obj.reconQuery(reconqrystr,logger)
if eventpayload:
eventqrystr = bi_sql_db_obj.prepQuerystr(eventpayload,row['datasource'])
table_name = bi_events_table_name
reconqrystr = f'SELECT * FROM {table_name} WHERE {eventqrystr}'
logger.debug(f'here is the query string for event table: {reconqrystr}')
eventfound = bi_sql_db_obj.reconQuery(reconqrystr,logger)
else:
eventfound=True
if countspayload:
for countsrw in countspayload:
tmp_countsrw=json.dumps(countsrw)
send_countsrw = {}
send_countsrw['ticket_number'] = countsrw['ticket_number']
send_countsrw['count_number'] = countsrw['count_number']
tmp_countsrw=json.dumps(send_countsrw)
countsqrystr = bi_sql_db_obj.prepQuerystr(tmp_countsrw,row['datasource'])
print(countsqrystr)
table_name = bi_violations_table_name
reconqrystr = f'SELECT * FROM {table_name} WHERE {countsqrystr}'
logger.debug(f'here is the query string for counts table: {reconqrystr}')
countsfound = bi_sql_db_obj.reconQuery(reconqrystr,logger)
if not countsfound:
break
Expand All @@ -111,7 +117,7 @@ def recondestination(dbclient,main_staging_collection,main_table_collection,reco
eventqrystr = bi_sql_db_obj.prepQuerystr(geopayload, row['datasource'])
table_name = bi_geo_table
reconqrystr = f'SELECT * FROM {table_name} WHERE {eventqrystr}'
print(f'Here is: {reconqrystr}')
logger.debug(f'here is the query string for geo table: {reconqrystr}')
geofound = bi_sql_db_obj.reconQuery(reconqrystr, logger)
else:
geofound=True
Expand Down

0 comments on commit d193888

Please sign in to comment.