public static final class QueryJobConfiguration.Builder extends JobConfiguration.Builder<QueryJobConfiguration,QueryJobConfiguration.Builder>
Modifier and Type | Method and Description |
---|---|
QueryJobConfiguration.Builder |
addNamedParameter(String name,
QueryParameterValue value)
Adds a named query parameter to the set of query parameters.
|
QueryJobConfiguration.Builder |
addPositionalParameter(QueryParameterValue value)
Adds a positional query parameter to the list of query parameters.
|
QueryJobConfiguration.Builder |
addTableDefinition(String tableName,
ExternalTableDefinition tableDefinition)
Adds a new external table definition.
|
QueryJobConfiguration |
build()
Creates an object.
|
QueryJobConfiguration.Builder |
setAllowLargeResults(Boolean allowLargeResults)
Sets whether the job is enabled to create arbitrarily large results.
|
QueryJobConfiguration.Builder |
setClustering(Clustering clustering)
Sets the clustering specification for the destination table.
|
QueryJobConfiguration.Builder |
setCreateDisposition(JobInfo.CreateDisposition createDisposition)
Sets whether the job is allowed to create tables.
|
QueryJobConfiguration.Builder |
setDefaultDataset(DatasetId defaultDataset)
Sets the default dataset.
|
QueryJobConfiguration.Builder |
setDefaultDataset(String defaultDataset)
Sets the default dataset.
|
QueryJobConfiguration.Builder |
setDestinationEncryptionConfiguration(EncryptionConfiguration encryptionConfiguration) |
QueryJobConfiguration.Builder |
setDestinationTable(TableId destinationTable)
Sets the table where to put query results.
|
QueryJobConfiguration.Builder |
setDryRun(Boolean dryRun)
Sets whether the job has to be dry run or not.
|
QueryJobConfiguration.Builder |
setFlattenResults(Boolean flattenResults)
Sets whether nested and repeated fields should be flattened.
|
QueryJobConfiguration.Builder |
setJobTimeoutMs(Long jobTimeoutMs)
[Optional] Job timeout in milliseconds.
|
QueryJobConfiguration.Builder |
setLabels(Map<String,String> labels)
The labels associated with this job.
|
QueryJobConfiguration.Builder |
setMaximumBillingTier(Integer maximumBillingTier)
Limits the billing tier for this job.
|
QueryJobConfiguration.Builder |
setMaximumBytesBilled(Long maximumBytesBilled)
Limits the bytes billed for this job.
|
QueryJobConfiguration.Builder |
setNamedParameters(Map<String,QueryParameterValue> values)
Sets the query parameters to a set of named query parameters to use in the query.
|
QueryJobConfiguration.Builder |
setPositionalParameters(Iterable<QueryParameterValue> values)
Sets the query parameters to a list of positional query parameters to use in the query.
|
QueryJobConfiguration.Builder |
setPriority(QueryJobConfiguration.Priority priority)
Sets a priority for the query.
|
QueryJobConfiguration.Builder |
setQuery(String query)
Sets the BigQuery SQL query to execute.
|
QueryJobConfiguration.Builder |
setRangePartitioning(RangePartitioning rangePartitioning)
Range partitioning specification for this table.
|
QueryJobConfiguration.Builder |
setSchemaUpdateOptions(List<JobInfo.SchemaUpdateOption> schemaUpdateOptions)
[Experimental] Sets options allowing the schema of the destination table to be updated as a
side effect of the query job.
|
QueryJobConfiguration.Builder |
setTableDefinitions(Map<String,ExternalTableDefinition> tableDefinitions)
Sets the external tables definitions.
|
QueryJobConfiguration.Builder |
setTimePartitioning(TimePartitioning timePartitioning)
Sets the time partitioning specification for the destination table.
|
QueryJobConfiguration.Builder |
setUseLegacySql(Boolean useLegacySql)
Sets whether to use BigQuery's legacy SQL dialect for this query.
|
QueryJobConfiguration.Builder |
setUseQueryCache(Boolean useQueryCache)
Sets whether to look for the result in the query cache.
|
QueryJobConfiguration.Builder |
setUserDefinedFunctions(List<UserDefinedFunction> userDefinedFunctions)
Sets user defined function resources that can be used by this query.
|
QueryJobConfiguration.Builder |
setWriteDisposition(JobInfo.WriteDisposition writeDisposition)
Sets the action that should occur if the destination table already exists.
|
public QueryJobConfiguration.Builder setQuery(String query)
public QueryJobConfiguration.Builder addPositionalParameter(QueryParameterValue value)
setPositionalParameters(Iterable)
for more details on the input requirements.
A positional parameter cannot be added after named parameters have been added.
public QueryJobConfiguration.Builder setPositionalParameters(Iterable<QueryParameterValue> values)
The set of query parameters must either be all positional or all named parameters. Positional parameters are denoted in the query with a question mark (?).
Additionally, useLegacySql must be set to false; query parameters cannot be used with legacy SQL.
The values parameter can be set to null to clear out the positional parameters so that named parameters can be used instead.
public QueryJobConfiguration.Builder addNamedParameter(String name, QueryParameterValue value)
setNamedParameters(Map)
for more details on the input requirements.
A named parameter cannot be added after positional parameters have been added.
public QueryJobConfiguration.Builder setNamedParameters(Map<String,QueryParameterValue> values)
The set of query parameters must either be all positional or all named parameters. Named parameters are denoted using an @ prefix, e.g. @myParam for a parameter named "myParam".
Additionally, useLegacySql must be set to false; query parameters cannot be used with legacy SQL.
The values parameter can be set to null to clear out the named parameters so that positional parameters can be used instead.
public QueryJobConfiguration.Builder setDestinationTable(TableId destinationTable)
setAllowLargeResults(Boolean)
is set to true
.public QueryJobConfiguration.Builder setDestinationEncryptionConfiguration(EncryptionConfiguration encryptionConfiguration)
public QueryJobConfiguration.Builder setTableDefinitions(Map<String,ExternalTableDefinition> tableDefinitions)
public QueryJobConfiguration.Builder addTableDefinition(String tableName, ExternalTableDefinition tableDefinition)
tableName
it
is updated.tableName
- name of the tabletableDefinition
- external data configuration for the table used by this querypublic QueryJobConfiguration.Builder setUserDefinedFunctions(List<UserDefinedFunction> userDefinedFunctions)
UserDefinedFunction.inline(String)
) or loaded from a Google
Cloud Storage URI (UserDefinedFunction.fromUri(String)
.public QueryJobConfiguration.Builder setCreateDisposition(JobInfo.CreateDisposition createDisposition)
public QueryJobConfiguration.Builder setWriteDisposition(JobInfo.WriteDisposition writeDisposition)
public QueryJobConfiguration.Builder setDefaultDataset(DatasetId defaultDataset)
public QueryJobConfiguration.Builder setDefaultDataset(String defaultDataset)
public QueryJobConfiguration.Builder setPriority(QueryJobConfiguration.Priority priority)
QueryJobConfiguration.Priority.INTERACTIVE
.public QueryJobConfiguration.Builder setAllowLargeResults(Boolean allowLargeResults)
true
the
query is allowed to create large results at a slight cost in performance. If true
setDestinationTable(TableId)
must be provided.public QueryJobConfiguration.Builder setUseQueryCache(Boolean useQueryCache)
setDestinationTable(TableId)
is not set.public QueryJobConfiguration.Builder setFlattenResults(Boolean flattenResults)
false
setAllowLargeResults(Boolean)
must be true
. By default results are
flattened.public QueryJobConfiguration.Builder setDryRun(Boolean dryRun)
public QueryJobConfiguration.Builder setUseLegacySql(Boolean useLegacySql)
false
. If set to false
, the query will use BigQuery's Standard SQL. When set to false
, the values of setAllowLargeResults(Boolean)
and setFlattenResults(Boolean)
are ignored; query will be run as if setAllowLargeResults(Boolean)
is true
and setFlattenResults(Boolean)
is
false
.
If set to null
or true
, legacy SQL dialect is used. This property is
experimental and might be subject to change.
public QueryJobConfiguration.Builder setMaximumBillingTier(Integer maximumBillingTier)
maximumBillingTier
- maximum billing tier for this jobpublic QueryJobConfiguration.Builder setMaximumBytesBilled(Long maximumBytesBilled)
maximumBytesBilled
- maximum bytes billed for this jobpublic QueryJobConfiguration.Builder setSchemaUpdateOptions(List<JobInfo.SchemaUpdateOption> schemaUpdateOptions)
public QueryJobConfiguration.Builder setTimePartitioning(TimePartitioning timePartitioning)
public QueryJobConfiguration.Builder setClustering(Clustering clustering)
public QueryJobConfiguration.Builder setJobTimeoutMs(Long jobTimeoutMs)
jobTimeoutMs
- jobTimeoutMs or null
for nonepublic QueryJobConfiguration.Builder setLabels(Map<String,String> labels)
labels
- labels or null
for nonepublic QueryJobConfiguration.Builder setRangePartitioning(RangePartitioning rangePartitioning)
rangePartitioning
- rangePartitioning or null
for nonepublic QueryJobConfiguration build()
JobConfiguration.Builder
build
in class JobConfiguration.Builder<QueryJobConfiguration,QueryJobConfiguration.Builder>
Copyright © 2019 Google LLC. All rights reserved.