google.cloud.bigquery.job.QueryJobConfig#

Methods

from_api_repr(resource) Factory: construct a job configuration given its API representation
to_api_repr() Build an API representation of the query job config.

Attributes

allow_large_results Allow large query results tables (legacy SQL, only)
clustering_fields Fields defining clustering for the table
create_disposition Specifies behavior for creating tables.
default_dataset the default dataset to use for unqualified table names in the query or None if not set.
destination table where results are written or None if not set.
destination_encryption_configuration Custom encryption configuration for the destination table.
dry_run True if this query should be a dry run to estimate costs.
flatten_results Flatten nested/repeated fields in results.
labels Labels for the job.
maximum_billing_tier Deprecated.
maximum_bytes_billed Maximum bytes to be billed for this job or None if not set.
priority Priority of the query.
query_parameters list of parameters for parameterized query (empty by default)
schema_update_options Specifies updates to the destination table schema to allow as a side effect of the query job.
table_definitions Definitions for external tables or None if not set.
time_partitioning Specifies time-based partitioning for the destination table.
udf_resources user defined function resources (empty by default)
use_legacy_sql Use legacy SQL syntax.
use_query_cache Look for the query result in the cache.
write_disposition Action that occurs if the destination table already exists.


class google.cloud.bigquery.job.QueryJobConfig(**kwargs)[source]#

Bases: google.cloud.bigquery.job._JobConfig

Configuration options for query jobs.

All properties in this class are optional. Values which are None -> server defaults. Set properties on the constructed configuration by using the property name as the name of a keyword argument.

allow_large_results#

Allow large query results tables (legacy SQL, only)

See https://g.co/cloud/bigquery/docs/reference/rest/v2/jobs#configuration.query.allowLargeResults

Type:bool
clustering_fields#

Fields defining clustering for the table

(Defaults to None).

Clustering fields are immutable after table creation.

Note

As of 2018-06-29, clustering fields cannot be set on a table which does not also have time partioning defined.

Type:Union[List[str], None]
create_disposition#

Specifies behavior for creating tables.

See https://g.co/cloud/bigquery/docs/reference/rest/v2/jobs#configuration.query.createDisposition

Type:google.cloud.bigquery.job.CreateDisposition
default_dataset#

the default dataset to use for unqualified table names in the query or None if not set.

The default_dataset setter accepts:

  • a Dataset, or
  • a DatasetReference, or
  • a str of the fully-qualified dataset ID in standard SQL format. The value must included a project ID and dataset ID separated by .. For example: your-project.your_dataset.

See https://g.co/cloud/bigquery/docs/reference/v2/jobs#configuration.query.defaultDataset

Type:google.cloud.bigquery.dataset.DatasetReference
destination#

table where results are written or None if not set.

The destination setter accepts:

  • a Table, or
  • a TableReference, or
  • a str of the fully-qualified table ID in standard SQL format. The value must included a project ID, dataset ID, and table ID, each separated by .. For example: your-project.your_dataset.your_table.

See https://g.co/cloud/bigquery/docs/reference/rest/v2/jobs#configuration.query.destinationTable

Type:google.cloud.bigquery.table.TableReference
destination_encryption_configuration#

Custom encryption configuration for the destination table.

Custom encryption configuration (e.g., Cloud KMS keys) or None if using default encryption.

See https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.destinationEncryptionConfiguration

Type:google.cloud.bigquery.table.EncryptionConfiguration
dry_run#

True if this query should be a dry run to estimate costs.

See https://g.co/cloud/bigquery/docs/reference/v2/jobs#configuration.dryRun

Type:bool
flatten_results#

Flatten nested/repeated fields in results. (Legacy SQL only)

See https://g.co/cloud/bigquery/docs/reference/rest/v2/jobs#configuration.query.flattenResults

Type:bool
classmethod from_api_repr(resource)#

Factory: construct a job configuration given its API representation

Parameters:resource (dict) – An extract job configuration in the same representation as is returned from the API.
Return type:google.cloud.bigquery.job._JobConfig
Returns:Configuration parsed from resource.
labels#

Labels for the job.

This method always returns a dict. To change a job’s labels, modify the dict, then call Client.update_job. To delete a label, set its value to None before updating.

Raises:ValueError – If value type is invalid.
Type:Dict[str, str]
maximum_billing_tier#

Deprecated. Changes the billing tier to allow high-compute queries.

See https://g.co/cloud/bigquery/docs/reference/rest/v2/jobs#configuration.query.maximumBillingTier

Type:int
maximum_bytes_billed#

Maximum bytes to be billed for this job or None if not set.

See https://g.co/cloud/bigquery/docs/reference/rest/v2/jobs#configuration.query.maximumBytesBilled

Type:int
priority#

Priority of the query.

See https://g.co/cloud/bigquery/docs/reference/rest/v2/jobs#configuration.query.priority

Type:google.cloud.bigquery.job.QueryPriority
query_parameters#

list of parameters for parameterized query (empty by default)

See: https://g.co/cloud/bigquery/docs/reference/rest/v2/jobs#configuration.query.queryParameters

Type:List[Union[google.cloud.bigquery.query.ArrayQueryParameter, google.cloud.bigquery.query.ScalarQueryParameter, google.cloud.bigquery.query.StructQueryParameter]]
schema_update_options#

Specifies updates to the destination table schema to allow as a side effect of the query job.

Type:List[google.cloud.bigquery.job.SchemaUpdateOption]
table_definitions#

Definitions for external tables or None if not set.

See https://g.co/cloud/bigquery/docs/reference/rest/v2/jobs#configuration.query.tableDefinitions

Type:Dict[str, google.cloud.bigquery.external_config.ExternalConfig]
time_partitioning#

Specifies time-based partitioning for the destination table.

Type:google.cloud.bigquery.table.TimePartitioning
to_api_repr()[source]#

Build an API representation of the query job config.

Returns:A dictionary in the format used by the BigQuery API.
Return type:dict
udf_resources#

user defined function resources (empty by default)

See: https://g.co/cloud/bigquery/docs/reference/rest/v2/jobs#configuration.query.userDefinedFunctionResources

Type:List[google.cloud.bigquery.query.UDFResource]
use_legacy_sql#

Use legacy SQL syntax.

See https://g.co/cloud/bigquery/docs/reference/v2/jobs#configuration.query.useLegacySql

Type:bool
use_query_cache#

Look for the query result in the cache.

See https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.useQueryCache

Type:bool
write_disposition#

Action that occurs if the destination table already exists.

See https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.writeDisposition

Type:google.cloud.bigquery.job.WriteDisposition