@@ -18,7 +18,7 @@ def check_for_json_files(file_path: str) -> bool:
18
18
return len (matching_files ) > 0
19
19
20
20
21
- def download_files_from_gcs (jur_abbreviation : str , file_path : str ) -> None :
21
+ def download_files_from_gcs (file_path : str ) -> None :
22
22
"""Download from GCS to local directory"""
23
23
try :
24
24
cloud_storage_client = storage .Client (project = GCP_PROJECT )
@@ -47,13 +47,12 @@ def download_files_from_gcs(jur_abbreviation: str, file_path: str) -> None:
47
47
logger .warning (
48
48
f"An error occurred during the attempt to download files from Google Cloud Storage: { e } "
49
49
)
50
- raise
51
50
52
51
53
52
def init_duckdb (
54
53
jurisdiction : str ,
55
54
entities : list [str ],
56
- last_scrape_time : str ,
55
+ last_scrape_end_time : str = None ,
57
56
) -> list [str ]:
58
57
"""Initialize Duckdb and load data, return list of tables created for usage downstream."""
59
58
@@ -62,9 +61,9 @@ def init_duckdb(
62
61
os .remove (db_path )
63
62
64
63
sub_directory = "*"
65
- if jurisdiction and last_scrape_time :
64
+ if jurisdiction and last_scrape_end_time :
66
65
sub_directory = jurisdiction .replace ("ocd-jurisdiction/" , "" )
67
- sub_directory = f"{ sub_directory } /{ last_scrape_time } "
66
+ sub_directory = f"{ sub_directory } /{ last_scrape_end_time } "
68
67
# Create DuckDB and load
69
68
logger .info ("Creating DuckDB schema and loading data..." )
70
69
con = duckdb .connect (db_path )
@@ -79,7 +78,7 @@ def init_duckdb(
79
78
logger .info (
80
79
"No file found in local directory, attempting to download from GCS, requires credentials in ENV."
81
80
)
82
- download_files_from_gcs (jurisdiction , sub_directory )
81
+ download_files_from_gcs (sub_directory )
83
82
84
83
# Load data into duckdb table
85
84
for entity in entities :
0 commit comments