@@ -221,6 +221,10 @@ class Client(ClientWithProject):
221221 client_options (Optional[Union[google.api_core.client_options.ClientOptions, Dict]]):
222222 Client options used to set user options on the client. API Endpoint
223223 should be set through client_options.
224+ default_job_creation_mode (Optional[str]):
225+ Sets the default job creation mode used by query methods such as
226+ query_and_wait(). For lightweight queries, JOB_CREATION_OPTIONAL is
227+ generally recommended.
224228
225229 Raises:
226230 google.auth.exceptions.DefaultCredentialsError:
@@ -243,6 +247,7 @@ def __init__(
243247 client_options : Optional [
244248 Union [google .api_core .client_options .ClientOptions , Dict [str , Any ]]
245249 ] = None ,
250+ default_job_creation_mode : Optional [str ] = None ,
246251 ) -> None :
247252 if client_options is None :
248253 client_options = {}
@@ -277,6 +282,7 @@ def __init__(
277282 self ._connection = Connection (self , ** kw_args )
278283 self ._location = location
279284 self ._default_load_job_config = copy .deepcopy (default_load_job_config )
285+ self .default_job_creation_mode = default_job_creation_mode
280286
281287 # Use property setter so validation can run.
282288 self .default_query_job_config = default_query_job_config
@@ -286,6 +292,15 @@ def location(self):
286292 """Default location for jobs / datasets / tables."""
287293 return self ._location
288294
295+ @property
296+ def default_job_creation_mode (self ):
297+ """Default job creation mode used for query execution."""
298+ return self ._default_job_creation_mode
299+
300+ @default_job_creation_mode .setter
301+ def default_job_creation_mode (self , value : Optional [str ]):
302+ self ._default_job_creation_mode = value
303+
289304 @property
290305 def default_query_job_config (self ) -> Optional [QueryJobConfig ]:
291306 """Default ``QueryJobConfig`` or ``None``.
@@ -3539,13 +3554,6 @@ def query_and_wait(
35393554 ) -> RowIterator :
35403555 """Run the query, wait for it to finish, and return the results.
35413556
3542- While ``jobCreationMode=JOB_CREATION_OPTIONAL`` is in preview in the
3543- ``jobs.query`` REST API, use the default ``jobCreationMode`` unless
3544- the environment variable ``QUERY_PREVIEW_ENABLED=true``. After
3545- ``jobCreationMode`` is GA, this method will always use
3546- ``jobCreationMode=JOB_CREATION_OPTIONAL``. See:
3547- https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query
3548-
35493557 Args:
35503558 query (str):
35513559 SQL query to be executed. Defaults to the standard SQL
@@ -4141,7 +4149,7 @@ def _list_rows_from_query_results(
41414149 rows that were affected.
41424150 query (Optional[str]):
41434151 The query text used.
4144- total_bytes_processed (Optinal [int]):
4152+ total_bytes_processed (Optional [int]):
41454153 total bytes processed from job statistics, if present.
41464154
41474155 Returns:
0 commit comments