Skip to content

Commit

Permalink
feat: add set_default_query_job_config to client
Browse files Browse the repository at this point in the history
  • Loading branch information
chelsea-lin committed Feb 28, 2023
1 parent cd0aaa1 commit e9b7fc3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions google/cloud/bigquery/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
13 changes: 13 additions & 0 deletions tests/unit/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit e9b7fc3

Please sign in to comment.