diff --git a/google/cloud/bigquery/client.py b/google/cloud/bigquery/client.py index b032665284..e0ca6f14ae 100644 --- a/google/cloud/bigquery/client.py +++ b/google/cloud/bigquery/client.py @@ -891,6 +891,12 @@ def set_iam_policy( return Policy.from_api_repr(response) + def set_default_query_job_config( + self, + default_query_job_config: QueryJobConfig + ) -> None: + self._default_query_job_config = copy.deepcopy(default_query_job_config) + def test_iam_permissions( self, table: Union[Table, TableReference, TableListItem, str], diff --git a/tests/unit/test_client.py b/tests/unit/test_client.py index 22f7286db3..5f898e8e58 100644 --- a/tests/unit/test_client.py +++ b/tests/unit/test_client.py @@ -1760,6 +1760,19 @@ def test_test_iam_permissions_w_invalid_table(self): with self.assertRaises(ValueError): client.test_iam_permissions(table_resource_string, PERMISSIONS) + def test_set_default_query_job_config(self): + from google.cloud.bigquery import QueryJobConfig + + creds = _make_credentials() + http = object() + client = self._make_one(project=self.PROJECT, credentials=creds, _http=http) + self.assertIsNone(client._default_query_job_config) + + job_config = QueryJobConfig() + job_config.dry_run = True + client.set_default_query_job_config(job_config) + self.assertIsInstance(client._default_query_job_config, QueryJobConfig) + def test_update_dataset_w_invalid_field(self): from google.cloud.bigquery.dataset import Dataset