Skip to content

Commit

Permalink
Fix: Fixes to paths.
Browse files Browse the repository at this point in the history
  • Loading branch information
nlarge-google committed Nov 7, 2024
1 parent 45a22fc commit 4fe6303
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def create_dest_table(
project_id: str,
dataset_id: str,
table_id: str,
schema_filepath: list,
schema_filepath: str,
bucket_name: str,
) -> bool:
table_ref = f"{project_id}.{dataset_id}.{table_id}"
Expand All @@ -281,18 +281,18 @@ def create_dest_table(
if not table:
logging.info(
(
f"Table {table_ref} currently does not exist. Attempting to create table."
f"Table {table_ref} currently does not exist. Attempting to create table from filepath {schema_filepath}."
)
)
file_name = os.path.split(schema_filepath)[1]
file_path = os.path.split(schema_filepath)[0]
if check_gcs_file_exists(schema_filepath, bucket_name):
schema = create_table_schema([], bucket_name, schema_filepath)
table = bigquery.Table(table_ref, schema=schema)
client.create_table(table)
logging.info(f"Table {table_ref} was created".format(table_id))
table_exists = True
else:
file_name = os.path.split(schema_filepath)[1]
file_path = os.path.split(schema_filepath)[0]
logging.info(
f"Error: Unable to create table {table_ref} because schema file {file_name} does not exist in location {file_path} in bucket {bucket_name}"
)
Expand Down
16 changes: 8 additions & 8 deletions datasets/nlm_rxnorm/pipelines/nlm_rxnorm/nlm_rxnorm_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"CHUNKSIZE": "750000",
"TARGET_GCS_BUCKET": "{{ var.value.composer_bucket }}",
"TARGET_GCS_PATH": "data/nlm_rxnorm",
"SCHEMA_FILEPATH": "data/nlm_rxnorm/schema/rxnatomarchive_schema.json",
"SCHEMA_FILEPATH": "data/nlm_rxnorm/schema",
"PROJECT_ID": "{{ var.value.gcp_project }}",
"DATASET_ID": "nlm_rxnorm",
},
Expand All @@ -118,7 +118,7 @@
"CHUNKSIZE": "750000",
"TARGET_GCS_BUCKET": "{{ var.value.composer_bucket }}",
"TARGET_GCS_PATH": "data/nlm_rxnorm",
"SCHEMA_FILEPATH": "data/nlm_rxnorm/schema/rxnconso_schema.json",
"SCHEMA_FILEPATH": "data/nlm_rxnorm/schema",
"PROJECT_ID": "{{ var.value.gcp_project }}",
"DATASET_ID": "nlm_rxnorm",
},
Expand All @@ -143,7 +143,7 @@
"CHUNKSIZE": "750000",
"TARGET_GCS_BUCKET": "{{ var.value.composer_bucket }}",
"TARGET_GCS_PATH": "data/nlm_rxnorm",
"SCHEMA_FILEPATH": "data/nlm_rxnorm/schema/rxncui_schema.json",
"SCHEMA_FILEPATH": "data/nlm_rxnorm/schema",
"PROJECT_ID": "{{ var.value.gcp_project }}",
"DATASET_ID": "nlm_rxnorm",
},
Expand All @@ -168,7 +168,7 @@
"CHUNKSIZE": "750000",
"TARGET_GCS_BUCKET": "{{ var.value.composer_bucket }}",
"TARGET_GCS_PATH": "data/nlm_rxnorm",
"SCHEMA_FILEPATH": "data/nlm_rxnorm/schema/rxncuichange_schema.json",
"SCHEMA_FILEPATH": "data/nlm_rxnorm/schema",
"PROJECT_ID": "{{ var.value.gcp_project }}",
"DATASET_ID": "nlm_rxnorm",
},
Expand All @@ -193,7 +193,7 @@
"CHUNKSIZE": "750000",
"TARGET_GCS_BUCKET": "{{ var.value.composer_bucket }}",
"TARGET_GCS_PATH": "data/nlm_rxnorm",
"SCHEMA_FILEPATH": "data/nlm_rxnorm/schema/rxndoc_schema.json",
"SCHEMA_FILEPATH": "data/nlm_rxnorm/schema",
"PROJECT_ID": "{{ var.value.gcp_project }}",
"DATASET_ID": "nlm_rxnorm",
},
Expand All @@ -218,7 +218,7 @@
"CHUNKSIZE": "750000",
"TARGET_GCS_BUCKET": "{{ var.value.composer_bucket }}",
"TARGET_GCS_PATH": "data/nlm_rxnorm",
"SCHEMA_FILEPATH": "data/nlm_rxnorm/schema/rxnrel_schema.json",
"SCHEMA_FILEPATH": "data/nlm_rxnorm/schema",
"PROJECT_ID": "{{ var.value.gcp_project }}",
"DATASET_ID": "nlm_rxnorm",
},
Expand All @@ -243,7 +243,7 @@
"CHUNKSIZE": "750000",
"TARGET_GCS_BUCKET": "{{ var.value.composer_bucket }}",
"TARGET_GCS_PATH": "data/nlm_rxnorm",
"SCHEMA_FILEPATH": "data/nlm_rxnorm/schema/rxnsab_schema.json",
"SCHEMA_FILEPATH": "data/nlm_rxnorm/schema",
"PROJECT_ID": "{{ var.value.gcp_project }}",
"DATASET_ID": "nlm_rxnorm",
},
Expand Down Expand Up @@ -293,7 +293,7 @@
"CHUNKSIZE": "750000",
"TARGET_GCS_BUCKET": "{{ var.value.composer_bucket }}",
"TARGET_GCS_PATH": "data/nlm_rxnorm",
"SCHEMA_FILEPATH": "data/nlm_rxnorm/schema/rxnsty_schema.json",
"SCHEMA_FILEPATH": "data/nlm_rxnorm/schema",
"PROJECT_ID": "{{ var.value.gcp_project }}",
"DATASET_ID": "nlm_rxnorm",
},
Expand Down
16 changes: 8 additions & 8 deletions datasets/nlm_rxnorm/pipelines/nlm_rxnorm/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ dag:
CHUNKSIZE: "750000"
TARGET_GCS_BUCKET: "{{ var.value.composer_bucket }}"
TARGET_GCS_PATH: "data/nlm_rxnorm"
SCHEMA_FILEPATH: "data/nlm_rxnorm/schema/rxnatomarchive_schema.json"
SCHEMA_FILEPATH: "data/nlm_rxnorm/schema"
PROJECT_ID: "{{ var.value.gcp_project }}"
DATASET_ID: "nlm_rxnorm"

Expand All @@ -112,7 +112,7 @@ dag:
CHUNKSIZE: "750000"
TARGET_GCS_BUCKET: "{{ var.value.composer_bucket }}"
TARGET_GCS_PATH: "data/nlm_rxnorm"
SCHEMA_FILEPATH: "data/nlm_rxnorm/schema/rxnconso_schema.json"
SCHEMA_FILEPATH: "data/nlm_rxnorm/schema"
PROJECT_ID: "{{ var.value.gcp_project }}"
DATASET_ID: "nlm_rxnorm"

Expand All @@ -136,7 +136,7 @@ dag:
CHUNKSIZE: "750000"
TARGET_GCS_BUCKET: "{{ var.value.composer_bucket }}"
TARGET_GCS_PATH: "data/nlm_rxnorm"
SCHEMA_FILEPATH: "data/nlm_rxnorm/schema/rxncui_schema.json"
SCHEMA_FILEPATH: "data/nlm_rxnorm/schema"
PROJECT_ID: "{{ var.value.gcp_project }}"
DATASET_ID: "nlm_rxnorm"

Expand All @@ -160,7 +160,7 @@ dag:
CHUNKSIZE: "750000"
TARGET_GCS_BUCKET: "{{ var.value.composer_bucket }}"
TARGET_GCS_PATH: "data/nlm_rxnorm"
SCHEMA_FILEPATH: "data/nlm_rxnorm/schema/rxncuichange_schema.json"
SCHEMA_FILEPATH: "data/nlm_rxnorm/schema"
PROJECT_ID: "{{ var.value.gcp_project }}"
DATASET_ID: "nlm_rxnorm"

Expand All @@ -184,7 +184,7 @@ dag:
CHUNKSIZE: "750000"
TARGET_GCS_BUCKET: "{{ var.value.composer_bucket }}"
TARGET_GCS_PATH: "data/nlm_rxnorm"
SCHEMA_FILEPATH: "data/nlm_rxnorm/schema/rxndoc_schema.json"
SCHEMA_FILEPATH: "data/nlm_rxnorm/schema"
PROJECT_ID: "{{ var.value.gcp_project }}"
DATASET_ID: "nlm_rxnorm"

Expand All @@ -208,7 +208,7 @@ dag:
CHUNKSIZE: "750000"
TARGET_GCS_BUCKET: "{{ var.value.composer_bucket }}"
TARGET_GCS_PATH: "data/nlm_rxnorm"
SCHEMA_FILEPATH: "data/nlm_rxnorm/schema/rxnrel_schema.json"
SCHEMA_FILEPATH: "data/nlm_rxnorm/schema"
PROJECT_ID: "{{ var.value.gcp_project }}"
DATASET_ID: "nlm_rxnorm"

Expand All @@ -232,7 +232,7 @@ dag:
CHUNKSIZE: "750000"
TARGET_GCS_BUCKET: "{{ var.value.composer_bucket }}"
TARGET_GCS_PATH: "data/nlm_rxnorm"
SCHEMA_FILEPATH: "data/nlm_rxnorm/schema/rxnsab_schema.json"
SCHEMA_FILEPATH: "data/nlm_rxnorm/schema"
PROJECT_ID: "{{ var.value.gcp_project }}"
DATASET_ID: "nlm_rxnorm"

Expand Down Expand Up @@ -280,7 +280,7 @@ dag:
CHUNKSIZE: "750000"
TARGET_GCS_BUCKET: "{{ var.value.composer_bucket }}"
TARGET_GCS_PATH: "data/nlm_rxnorm"
SCHEMA_FILEPATH: "data/nlm_rxnorm/schema/rxnsty_schema.json"
SCHEMA_FILEPATH: "data/nlm_rxnorm/schema"
PROJECT_ID: "{{ var.value.gcp_project }}"
DATASET_ID: "nlm_rxnorm"

Expand Down

0 comments on commit 4fe6303

Please sign in to comment.