Skip to content

Commit

Permalink
Fix: Resolve coding error on check if file exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
nlarge-google committed Nov 6, 2024
1 parent a81b56f commit 06b7f08
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def load_process_filegroup_data(
)
zip_file = zip_file_list[0] if zip_file_list else ""
if zip_file != "":
if os.path.isfile(zip_file):
if fetch_gcs_file_names(target_gcs_bucket, zip_file):
source_location_gcs = os.path.join("gs://", target_gcs_bucket, zip_file)
download_file_gcs(
project_id=project_id,
Expand All @@ -154,6 +154,8 @@ def load_process_filegroup_data(
target_file=os.path.join(zip_path, os.path.basename(zip_file)),
target_gcs_bucket=target_gcs_bucket,
)
else:
raise(f"File gs://{target_gcs_bucket}/{zip_file} does not exist. Cannot continue.")
else:
# zip file does not exist
logging.info(
Expand Down Expand Up @@ -219,7 +221,7 @@ def load_source_data(
project_id=project_id,
dataset_id=dataset_id,
table_id=table_id,
schema_filepath=schema_filepath,
schema_filepath=f"{schema_filepath}/{str.lower(process_filegroup)}_schema.json",
bucket_name=target_gcs_bucket,
)
if table_exists:
Expand Down

0 comments on commit 06b7f08

Please sign in to comment.