Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
feat: Destination tables are no-longer removed by create_job
  • Loading branch information
Jim Fulton committed Aug 20, 2021
commit 1414c7775d997e0dd6609d007b6567260b4584ff
1 change: 0 additions & 1 deletion google/cloud/bigquery/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1937,7 +1937,6 @@ def create_job(
)
elif "query" in job_config:
copy_config = copy.deepcopy(job_config)
_del_sub_prop(copy_config, ["query", "destinationTable"])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that we are no longer removing the property, we could just collapse this whole clause into:

        elif "query" in job_config:
            query_job_config = google.cloud.bigquery.job.QueryJobConfig.from_api_repr(
                job_config
            )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. #893

query_job_config = google.cloud.bigquery.job.QueryJobConfig.from_api_repr(
copy_config
)
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2606,8 +2606,6 @@ def _create_job_helper(self, job_config):
}
conn = client._connection = make_connection(RESOURCE)
client.create_job(job_config=job_config)
if "query" in job_config:
_helpers._del_sub_prop(job_config, ["query", "destinationTable"])

conn.api_request.assert_called_once_with(
method="POST",
Expand Down Expand Up @@ -2732,7 +2730,7 @@ def test_create_job_query_config_w_rateLimitExceeded_error(self):
}
data_without_destination = {
"jobReference": {"projectId": self.PROJECT, "jobId": mock.ANY},
"configuration": {"query": {"query": query, "useLegacySql": False}},
"configuration": configuration,
}

creds = _make_credentials()
Expand Down