Skip to content

Commit

Permalink
feat: expose configuration property on CopyJob, ExtractJob, LoadJob, …
Browse files Browse the repository at this point in the history
…QueryJob (googleapis#1521)

* feat: expose configuration property on CopyJob, ExtractJob, LoadJob, QueryJob

Note for google-cloud-bigquery developers: This also refactors these classes so
that `_set_properties` does not modify the `_properties` dictionary in-place.
Doing so was also mutating the request object, making it difficult to debug
what request was _actually_ sent. Before this change, many tests hallucinated
that the request was always equal to the response.

* E           google.api_core.exceptions.BadRequest: 400 Clone operation with write disposition WRITE_TRUNCATE is not supported. Please try again with WRITE_EMPTY.
  • Loading branch information
tswast authored and abdelmegahedgoogle committed Apr 17, 2023
1 parent 528ae9e commit 96a6689
Show file tree
Hide file tree
Showing 10 changed files with 333 additions and 289 deletions.
9 changes: 1 addition & 8 deletions google/cloud/bigquery/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1976,15 +1976,8 @@ def create_job(
)
destination = _get_sub_prop(job_config, ["copy", "destinationTable"])
destination = TableReference.from_api_repr(destination)
sources = []
source_configs = _get_sub_prop(job_config, ["copy", "sourceTables"])
if source_configs is None:
source_configs = [_get_sub_prop(job_config, ["copy", "sourceTable"])]
for source_config in source_configs:
table_ref = TableReference.from_api_repr(source_config)
sources.append(table_ref)
return self.copy_table(
sources,
[], # Source table(s) already in job_config resource.
destination,
job_config=typing.cast(CopyJobConfig, copy_job_config),
retry=retry,
Expand Down
Loading

0 comments on commit 96a6689

Please sign in to comment.