Skip to content

Commit

Permalink
Merge pull request #370 from ianco/master
Browse files Browse the repository at this point in the history
Fix data caching
  • Loading branch information
swcurran authored Sep 3, 2024
2 parents 7893688 + a942e6c commit 79c7ccb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions data-pipeline/bcreg/bcreg_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ def cache_lear_bcreg_corp_tables(self, specific_corps, generate_individual_sql=F
txn_ids_list = []
corp_nums_list_str = self.id_where_in(corp_nums_list, True)
corp_num_where = 'identifier in (' + corp_nums_list_str + ')' if 0 < len(corp_nums_list_str) else "identifier = ''"
corp_num_where_ex = corp_num_where + f" UNION {UNION_SELECT_PLACEHOLDER} WHERE id in (select business_id from party_roles, parties where party_roles.party_id = parties.id and parties." + corp_num_where + ")"
corp_num_where_ex = corp_num_where + f" UNION {UNION_SELECT_PLACEHOLDER} WHERE id in (select distinct business_id from party_roles_version, parties_version where party_roles_version.party_id = parties_version.id and parties_version." + corp_num_where + ")"
for corp_table in self.lear_corp_tables:
_rows = self.get_bcreg_table(corp_table, corp_num_where_ex, '', True, generate_individual_sql, use_sec=use_sec)
if corp_table == 'businesses':
Expand All @@ -696,7 +696,7 @@ def cache_lear_bcreg_corp_tables(self, specific_corps, generate_individual_sql=F

party_ids_list = []
bus_id_where = 'business_id in (' + self.id_where_in(bus_ids_list, True) + ')' if 0 < len(bus_ids_list) else "business_id = 0"
bus_id_where += f" UNION {UNION_SELECT_PLACEHOLDER} WHERE business_id in (select business_id from party_roles, parties where party_roles.party_id = parties.id and parties." + corp_num_where + ")"
bus_id_where += f" UNION {UNION_SELECT_PLACEHOLDER} WHERE business_id in (select distinct business_id from party_roles_version, parties_version where party_roles_version.party_id = parties_version.id and parties_version." + corp_num_where + ")"
for other_table in self.lear_other_tables:
_rows = self.get_bcreg_table(other_table, bus_id_where, '', True, generate_individual_sql, use_sec=use_sec)
if other_table == 'party_roles':
Expand Down
1 change: 1 addition & 0 deletions data-pipeline/bcreg/find-test-corps-lear.py
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,7 @@
"FM0733881",
"FM0733880",
"FM0650512",
"FM1003299",
]


Expand Down
9 changes: 5 additions & 4 deletions data-pipeline/bcreg/find-test-corps.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,9 @@
'FM1048326',
'A0132048',
'A0133092',
'BC1489198',
'BC1026494',
'1489198',
'1026494',
'0593892',
]


Expand Down Expand Up @@ -438,8 +439,8 @@
# get specific test corps (there are about 6)
print("Get specific corps")
corps = bc_registries.get_specific_corps(specific_corps)
#corps_2 = bc_registries.get_specific_corps(specific_corps_2)
#corps.extend(corps_2)
corps_2 = bc_registries.get_specific_corps(specific_corps_2)
corps.extend(corps_2)

print("Find unprocessed events for each corp")
last_event_dt = bc_registries.get_event_effective_date(prev_event_id)
Expand Down

0 comments on commit 79c7ccb

Please sign in to comment.