Skip to content

Commit

Permalink
feat: Destination tables are no-longer removed by create_job (#891)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimfulton committed Aug 23, 2021
1 parent 60e73fe commit 2689df4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
2 changes: 0 additions & 2 deletions google/cloud/bigquery/client.py
Expand Up @@ -49,7 +49,6 @@
DEFAULT_CLIENT_INFO as DEFAULT_BQSTORAGE_CLIENT_INFO,
)

from google.cloud.bigquery._helpers import _del_sub_prop
from google.cloud.bigquery._helpers import _get_sub_prop
from google.cloud.bigquery._helpers import _record_field_to_json
from google.cloud.bigquery._helpers import _str_or_none
Expand Down Expand Up @@ -1937,7 +1936,6 @@ def create_job(
)
elif "query" in job_config:
copy_config = copy.deepcopy(job_config)
_del_sub_prop(copy_config, ["query", "destinationTable"])
query_job_config = google.cloud.bigquery.job.QueryJobConfig.from_api_repr(
copy_config
)
Expand Down
6 changes: 1 addition & 5 deletions tests/unit/test_client.py
Expand Up @@ -2594,8 +2594,6 @@ def test_delete_table_w_not_found_ok_true(self):
conn.api_request.assert_called_with(method="DELETE", path=path, timeout=None)

def _create_job_helper(self, job_config):
from google.cloud.bigquery import _helpers

creds = _make_credentials()
http = object()
client = self._make_one(project=self.PROJECT, credentials=creds, _http=http)
Expand All @@ -2606,8 +2604,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 +2728,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

0 comments on commit 2689df4

Please sign in to comment.