google.cloud.bigquery.job.QueryJobConfig¶
- class google.cloud.bigquery.job.QueryJobConfig(**kwargs)[source]¶
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.Methods
__init__
(**kwargs)Initialize self.
from_api_repr
(resource)Factory: construct a job configuration given its API representation
Build an API representation of the query job config.
Attributes
Allow large query results tables (legacy SQL, only)
Fields defining clustering for the table
Connection properties.
Specifies behavior for creating tables.
[Preview] If
True
, creates a new session, wheresession_info
will contain a random server generated session id.the default dataset to use for unqualified table names in the query or
None
if not set.table where results are written or
None
if not set.Custom encryption configuration for the destination table.
True
if this query should be a dry run to estimate costs.Flatten nested/repeated fields in results.
Optional parameter.
Labels for the job.
Deprecated.
Maximum bytes to be billed for this job or
None
if not set.Priority of the query.
list of parameters for parameterized query (empty by default)
Optional[google.cloud.bigquery.table.RangePartitioning]: Configures range-based partitioning for destination table.
Specifies updates to the destination table schema to allow as a side effect of the query job.
Options controlling the execution of scripts.
Dict[str, google.cloud.bigquery.external_config.ExternalConfig]: Definitions for external tables or
None
if not set.Specifies time-based partitioning for the destination table.
user defined function resources (empty by default)
Use legacy SQL syntax.
Look for the query result in the cache.
Action that occurs if the destination table already exists.
- __setattr__(name, value)¶
Override to be able to raise error if an unknown property is being set
- property allow_large_results¶
Allow large query results tables (legacy SQL, only)
- Type
- property clustering_fields¶
Fields defining clustering for the table
(Defaults to
None
).Clustering fields are immutable after table creation.
Note
BigQuery supports clustering for both partitioned and non-partitioned tables.
- Type
Optional[List[str]]
- property connection_properties: List[google.cloud.bigquery.query.ConnectionProperty]¶
Connection properties.
New in version 2.29.0.
- property create_disposition¶
Specifies behavior for creating tables.
- property create_session: Optional[bool]¶
[Preview] If
True
, creates a new session, wheresession_info
will contain a random server generated session id.If
False
, runs query with an existingsession_id
passed inconnection_properties
, otherwise runs query in non-session mode.New in version 2.29.0.
- property 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
, ora
DatasetReference
, ora
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
.
- property destination¶
table where results are written or
None
if not set.The
destination
setter accepts:a
Table
, ora
TableReference
, ora
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
.
- property destination_encryption_configuration¶
Custom encryption configuration for the destination table.
Custom encryption configuration (e.g., Cloud KMS keys) or
None
if using default encryption.
- property dry_run¶
True
if this query should be a dry run to estimate costs.See https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfiguration.FIELDS.dry_run
- Type
- property flatten_results¶
Flatten nested/repeated fields in results. (Legacy SQL only)
- Type
- classmethod from_api_repr(resource: dict) → google.cloud.bigquery.job.base._JobConfig¶
Factory: construct a job configuration given its API representation
- Parameters
resource (Dict) – A job configuration in the same representation as is returned from the API.
- Returns
Configuration parsed from
resource
.- Return type
google.cloud.bigquery.job._JobConfig
- property job_timeout_ms¶
Optional parameter. Job timeout in milliseconds. If this time limit is exceeded, BigQuery might attempt to stop the job. https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfiguration.FIELDS.job_timeout_ms e.g.
job_config = bigquery.QueryJobConfig( job_timeout_ms = 5000 ) or job_config.job_timeout_ms = 5000
- Raises
ValueError – If
value
type is invalid.
- property labels¶
Labels for the job.
This method always returns a dict. Once a job has been created on the server, its labels cannot be modified anymore.
- Raises
ValueError – If
value
type is invalid.- Type
- property maximum_billing_tier¶
Deprecated. Changes the billing tier to allow high-compute queries.
- Type
- property priority¶
Priority of the query.
See https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationQuery.FIELDS.priority
- property query_parameters¶
list of parameters for parameterized query (empty by default)
- property range_partitioning¶
Optional[google.cloud.bigquery.table.RangePartitioning]: Configures range-based partitioning for destination table.
Note
Beta. The integer range partitioning feature is in a pre-release state and might change or have limited support.
Only specify at most one of
time_partitioning
orrange_partitioning
.- Raises
ValueError – If the value is not
RangePartitioning
orNone
.
- property schema_update_options¶
Specifies updates to the destination table schema to allow as a side effect of the query job.
- Type
- property script_options: google.cloud.bigquery.job.query.ScriptOptions¶
Options controlling the execution of scripts.
https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#scriptoptions
- property table_definitions¶
Dict[str, google.cloud.bigquery.external_config.ExternalConfig]: Definitions for external tables or
None
if not set.
- property time_partitioning¶
Specifies time-based partitioning for the destination table.
Only specify at most one of
time_partitioning
orrange_partitioning
.- Raises
ValueError – If the value is not
TimePartitioning
orNone
.- Type
- to_api_repr() → dict[source]¶
Build an API representation of the query job config.
- Returns
A dictionary in the format used by the BigQuery API.
- Return type
Dict
- property udf_resources¶
user defined function resources (empty by default)
- Type
- property use_legacy_sql¶
Use legacy SQL syntax.
- Type
- property use_query_cache¶
Look for the query result in the cache.
- Type
- property write_disposition¶
Action that occurs if the destination table already exists.