Class ConnectionSettings.Builder (2.20.0)

public abstract static class ConnectionSettings.Builder

Inheritance

java.lang.Object > ConnectionSettings.Builder

Constructors

Builder()

public Builder()

Methods

build()

public abstract ConnectionSettings build()

Creates a ConnectionSettings object.

Returns
TypeDescription
ConnectionSettings

setAllowLargeResults(Boolean allowLargeResults)

public abstract ConnectionSettings.Builder setAllowLargeResults(Boolean allowLargeResults)

Sets whether the job is enabled to create arbitrarily large results. If true the query is allowed to create large results at a slight cost in performance. If true ConnectionSettings.Builder#setDestinationTable(TableId) must be provided. See Also: Returning Large Query Results

Parameter
NameDescription
allowLargeResultsBoolean
Returns
TypeDescription
ConnectionSettings.Builder

setClustering(Clustering clustering)

public abstract ConnectionSettings.Builder setClustering(Clustering clustering)

Sets the clustering specification for the destination table.

Parameter
NameDescription
clusteringClustering
Returns
TypeDescription
ConnectionSettings.Builder

setConnectionProperties(List<ConnectionProperty> connectionProperties)

public abstract ConnectionSettings.Builder setConnectionProperties(List<ConnectionProperty> connectionProperties)

Sets a connection-level property to customize query behavior.

Parameter
NameDescription
connectionPropertiesList<ConnectionProperty>

connectionProperties or null for none

Returns
TypeDescription
ConnectionSettings.Builder

setCreateDisposition(JobInfo.CreateDisposition createDisposition)

public abstract ConnectionSettings.Builder setCreateDisposition(JobInfo.CreateDisposition createDisposition)

Sets whether the job is allowed to create tables. See Also: Create Disposition

Parameter
NameDescription
createDispositionJobInfo.CreateDisposition
Returns
TypeDescription
ConnectionSettings.Builder

setCreateSession(Boolean createSession)

public abstract ConnectionSettings.Builder setCreateSession(Boolean createSession)

Sets whether to create a new session. If true a random session id will be generated by BigQuery. If false, runs query with an existing session_id passed in ConnectionProperty, otherwise runs query in non-session mode."

Parameter
NameDescription
createSessionBoolean
Returns
TypeDescription
ConnectionSettings.Builder

setDefaultDataset(DatasetId datasetId)

public abstract ConnectionSettings.Builder setDefaultDataset(DatasetId datasetId)

Sets the default dataset. This dataset is used for all unqualified table names used in the query.

Parameter
NameDescription
datasetIdDatasetId
Returns
TypeDescription
ConnectionSettings.Builder

setDestinationEncryptionConfiguration(EncryptionConfiguration destinationEncryptionConfiguration)

public abstract ConnectionSettings.Builder setDestinationEncryptionConfiguration(EncryptionConfiguration destinationEncryptionConfiguration)

Sets the custom encryption configuration (e.g., Cloud KMS keys).

Parameter
NameDescription
destinationEncryptionConfigurationEncryptionConfiguration

destinationEncryptionConfiguration or null for none

Returns
TypeDescription
ConnectionSettings.Builder

setDestinationTable(TableId destinationTable)

public abstract ConnectionSettings.Builder setDestinationTable(TableId destinationTable)

Sets the table where to put query results. If not provided a new table is created. This value is required if ConnectionSettings.Builder#setAllowLargeResults(Boolean) is set to true.

Parameter
NameDescription
destinationTableTableId
Returns
TypeDescription
ConnectionSettings.Builder

setFlattenResults(Boolean flattenResults)

public abstract ConnectionSettings.Builder setFlattenResults(Boolean flattenResults)

Sets whether nested and repeated fields should be flattened. If set to false ConnectionSettings.Builder#setAllowLargeResults(Boolean) must be true. By default results are flattened. See Also: Flatten

Parameter
NameDescription
flattenResultsBoolean
Returns
TypeDescription
ConnectionSettings.Builder

setJobTimeoutMs(Long jobTimeoutMs)

public abstract ConnectionSettings.Builder setJobTimeoutMs(Long jobTimeoutMs)

[Optional] Job timeout in milliseconds. If this time limit is exceeded, BigQuery may attempt to terminate the job.

Parameter
NameDescription
jobTimeoutMsLong

jobTimeoutMs or null for none

Returns
TypeDescription
ConnectionSettings.Builder

setMaxResultPerPage(Integer maxResultPerPage)

public abstract ConnectionSettings.Builder setMaxResultPerPage(Integer maxResultPerPage)

Sets the maximum records per page to be used for pagination. This is used as an input for the tabledata.list and jobs.getQueryResults RPC calls

Parameter
NameDescription
maxResultPerPageInteger
Returns
TypeDescription
ConnectionSettings.Builder

setMaxResults(Long maxResults)

public abstract ConnectionSettings.Builder setMaxResults(Long maxResults)

Sets the maximum number of rows of data to return per page of results. Setting this flag to a small value such as 1000 and then paging through results might improve reliability when the query result set is large. In addition to this limit, responses are also limited to 10 MB. By default, there is no maximum row count, and only the byte limit applies.

Parameter
NameDescription
maxResultsLong

maxResults or null for none

Returns
TypeDescription
ConnectionSettings.Builder

setMaximumBillingTier(Integer maximumBillingTier)

public abstract ConnectionSettings.Builder setMaximumBillingTier(Integer maximumBillingTier)

Limits the billing tier for this job. Queries that have resource usage beyond this tier will fail (without incurring a charge). If unspecified, this will be set to your project default.

Parameter
NameDescription
maximumBillingTierInteger

maximum billing tier for this job

Returns
TypeDescription
ConnectionSettings.Builder

setMaximumBytesBilled(Long maximumBytesBilled)

public abstract ConnectionSettings.Builder setMaximumBytesBilled(Long maximumBytesBilled)

Limits the bytes billed for this job. Queries that will have bytes billed beyond this limit will fail (without incurring a charge). If unspecified, this will be set to your project default.

Parameter
NameDescription
maximumBytesBilledLong

maximum bytes billed for this job

Returns
TypeDescription
ConnectionSettings.Builder

setMinResultSize(Integer minResultSize)

public abstract ConnectionSettings.Builder setMinResultSize(Integer minResultSize)

Sets the minimum result size for which the Read API will be enabled

Parameter
NameDescription
minResultSizeInteger

minResultSize

Returns
TypeDescription
ConnectionSettings.Builder

setNumBufferedRows(Integer numBufferedRows)

public abstract ConnectionSettings.Builder setNumBufferedRows(Integer numBufferedRows)

Sets the number of rows in the buffer (a blocking queue) that query results are consumed from.

Parameter
NameDescription
numBufferedRowsInteger

numBufferedRows or null for none

Returns
TypeDescription
ConnectionSettings.Builder

setPriority(QueryJobConfiguration.Priority priority)

public abstract ConnectionSettings.Builder setPriority(QueryJobConfiguration.Priority priority)

Sets a priority for the query. If not specified the priority is assumed to be Priority#INTERACTIVE.

Parameter
NameDescription
priorityQueryJobConfiguration.Priority
Returns
TypeDescription
ConnectionSettings.Builder

setRangePartitioning(RangePartitioning rangePartitioning)

public abstract ConnectionSettings.Builder setRangePartitioning(RangePartitioning rangePartitioning)

Range partitioning specification for this table. Only one of timePartitioning and rangePartitioning should be specified.

Parameter
NameDescription
rangePartitioningRangePartitioning

rangePartitioning or null for none

Returns
TypeDescription
ConnectionSettings.Builder

setRequestTimeout(Long timeoutMs)

public abstract ConnectionSettings.Builder setRequestTimeout(Long timeoutMs)

Sets how long to wait for the query to complete, in milliseconds, before the request times out and returns. Note that this is only a timeout for the request, not the query. If the query takes longer to run than the timeout value, the call returns without any results and with the 'jobComplete' flag set to false. You can call GetQueryResults() to wait for the query to complete and read the results. The default value is 10000 milliseconds (10 seconds).

Parameter
NameDescription
timeoutMsLong

or null for none

Returns
TypeDescription
ConnectionSettings.Builder

setSchemaUpdateOptions(List<JobInfo.SchemaUpdateOption> schemaUpdateOptions)

public abstract ConnectionSettings.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. Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema.

Parameter
NameDescription
schemaUpdateOptionsList<SchemaUpdateOption>
Returns
TypeDescription
ConnectionSettings.Builder

setTableDefinitions(Map<String,ExternalTableDefinition> tableDefinitions)

public abstract ConnectionSettings.Builder setTableDefinitions(Map<String,ExternalTableDefinition> tableDefinitions)

Sets the external tables definitions. If querying external data sources outside of BigQuery, this value describes the data format, location and other properties of the data sources. By defining these properties, the data sources can be queried as if they were standard BigQuery tables.

Parameter
NameDescription
tableDefinitionsMap<String,ExternalTableDefinition>
Returns
TypeDescription
ConnectionSettings.Builder

setTimePartitioning(TimePartitioning timePartitioning)

public abstract ConnectionSettings.Builder setTimePartitioning(TimePartitioning timePartitioning)

Sets the time partitioning specification for the destination table.

Parameter
NameDescription
timePartitioningTimePartitioning
Returns
TypeDescription
ConnectionSettings.Builder

setTotalToPageRowCountRatio(Integer totalToPageRowCountRatio)

public abstract ConnectionSettings.Builder setTotalToPageRowCountRatio(Integer totalToPageRowCountRatio)

Sets a ratio of the total number of records and the records returned in the current page. This value is checked before calling the Read API

Parameter
NameDescription
totalToPageRowCountRatioInteger

totalToPageRowCountRatio

Returns
TypeDescription
ConnectionSettings.Builder

setUseQueryCache(Boolean useQueryCache)

public abstract ConnectionSettings.Builder setUseQueryCache(Boolean useQueryCache)

Sets whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. Moreover, the query cache is only available when ConnectionSettings.Builder#setDestinationTable(TableId) is not set. See Also: Query Caching

Parameter
NameDescription
useQueryCacheBoolean
Returns
TypeDescription
ConnectionSettings.Builder

setUseReadAPI(Boolean useReadAPI)

public abstract ConnectionSettings.Builder setUseReadAPI(Boolean useReadAPI)

Sets useReadAPI flag, enabled by default. Read API will be used if the underlying conditions are satisfied and this flag is enabled

Parameter
NameDescription
useReadAPIBoolean

or true for none

Returns
TypeDescription
ConnectionSettings.Builder

setUserDefinedFunctions(List<UserDefinedFunction> userDefinedFunctions)

public abstract ConnectionSettings.Builder setUserDefinedFunctions(List<UserDefinedFunction> userDefinedFunctions)

Sets user defined function resources that can be used by this query. Function resources can either be defined inline (UserDefinedFunction#inline(String)) or loaded from a Google Cloud Storage URI (UserDefinedFunction#fromUri(String).

Parameter
NameDescription
userDefinedFunctionsList<UserDefinedFunction>
Returns
TypeDescription
ConnectionSettings.Builder

setWriteDisposition(JobInfo.WriteDisposition writeDisposition)

public abstract ConnectionSettings.Builder setWriteDisposition(JobInfo.WriteDisposition writeDisposition)

Sets the action that should occur if the destination table already exists. See Also: Write Disposition

Parameter
NameDescription
writeDispositionJobInfo.WriteDisposition
Returns
TypeDescription
ConnectionSettings.Builder