Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions parsons/google/google_bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,9 @@ def copy_from_gcs(
Other arguments to pass to the underlying load_table_from_uri
call on the BigQuery client.
"""
self._validate_copy_inputs(if_exists=if_exists, data_type=data_type)
self._validate_copy_inputs(
if_exists=if_exists, data_type=data_type, override_data_type_check=True
)

job_config = self._process_job_config(
job_config=job_config,
Expand Down Expand Up @@ -1559,13 +1561,15 @@ def _fetch_query_results(self, cursor) -> Table:
ptable = petl.frompickle(temp_filename)
return Table(ptable)

def _validate_copy_inputs(self, if_exists: str, data_type: str):
def _validate_copy_inputs(
self, if_exists: str, data_type: str, override_data_type_check: bool = False
):
if if_exists not in ["fail", "truncate", "append", "drop"]:
raise ValueError(
f"Unexpected value for if_exists: {if_exists}, must be one of "
'"append", "drop", "truncate", or "fail"'
)
if data_type not in ["csv", "json"]:
if data_type not in ["csv", "json"] and not override_data_type_check:
raise ValueError(f"Only supports csv or json files [data_type = {data_type}]")

def _load_table_from_uri(
Expand Down
Loading