Skip to content

Commit 2689df4

Browse files
author
Jim Fulton
authored
feat: Destination tables are no-longer removed by create_job (#891)
1 parent 60e73fe commit 2689df4

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

google/cloud/bigquery/client.py

-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
DEFAULT_CLIENT_INFO as DEFAULT_BQSTORAGE_CLIENT_INFO,
5050
)
5151

52-
from google.cloud.bigquery._helpers import _del_sub_prop
5352
from google.cloud.bigquery._helpers import _get_sub_prop
5453
from google.cloud.bigquery._helpers import _record_field_to_json
5554
from google.cloud.bigquery._helpers import _str_or_none
@@ -1937,7 +1936,6 @@ def create_job(
19371936
)
19381937
elif "query" in job_config:
19391938
copy_config = copy.deepcopy(job_config)
1940-
_del_sub_prop(copy_config, ["query", "destinationTable"])
19411939
query_job_config = google.cloud.bigquery.job.QueryJobConfig.from_api_repr(
19421940
copy_config
19431941
)

tests/unit/test_client.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -2594,8 +2594,6 @@ def test_delete_table_w_not_found_ok_true(self):
25942594
conn.api_request.assert_called_with(method="DELETE", path=path, timeout=None)
25952595

25962596
def _create_job_helper(self, job_config):
2597-
from google.cloud.bigquery import _helpers
2598-
25992597
creds = _make_credentials()
26002598
http = object()
26012599
client = self._make_one(project=self.PROJECT, credentials=creds, _http=http)
@@ -2606,8 +2604,6 @@ def _create_job_helper(self, job_config):
26062604
}
26072605
conn = client._connection = make_connection(RESOURCE)
26082606
client.create_job(job_config=job_config)
2609-
if "query" in job_config:
2610-
_helpers._del_sub_prop(job_config, ["query", "destinationTable"])
26112607

26122608
conn.api_request.assert_called_once_with(
26132609
method="POST",
@@ -2732,7 +2728,7 @@ def test_create_job_query_config_w_rateLimitExceeded_error(self):
27322728
}
27332729
data_without_destination = {
27342730
"jobReference": {"projectId": self.PROJECT, "jobId": mock.ANY},
2735-
"configuration": {"query": {"query": query, "useLegacySql": False}},
2731+
"configuration": configuration,
27362732
}
27372733

27382734
creds = _make_credentials()

0 commit comments

Comments
 (0)