Class ConnectionSettings.Builder (2.44.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
Type Description
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
Name Description
allowLargeResults Boolean
Returns
Type Description
ConnectionSettings.Builder

setClustering(Clustering clustering)

public abstract ConnectionSettings.Builder setClustering(Clustering clustering)

Sets the clustering specification for the destination table.

Parameter
Name Description
clustering Clustering
Returns
Type Description
ConnectionSettings.Builder

setConnectionProperties(List<ConnectionProperty> connectionProperties)

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

Sets a connection-level property to customize query behavior.

Parameter
Name Description
connectionProperties List<ConnectionProperty>

connectionProperties or null for none

Returns
Type Description
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
Name Description
createDisposition JobInfo.CreateDisposition
Returns
Type Description
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
Name Description
createSession Boolean
Returns
Type Description
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
Name Description
datasetId DatasetId
Returns
Type Description
ConnectionSettings.Builder

setDestinationEncryptionConfiguration(EncryptionConfiguration destinationEncryptionConfiguration)

public abstract ConnectionSettings.Builder setDestinationEncryptionConfiguration(EncryptionConfiguration destinationEncryptionConfiguration)

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

Parameter
Name Description
destinationEncryptionConfiguration EncryptionConfiguration

destinationEncryptionConfiguration or null for none

Returns
Type Description
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
Name Description
destinationTable TableId
Returns
Type Description
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
Name Description
flattenResults Boolean
Returns
Type Description
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
Name Description
jobTimeoutMs Long

jobTimeoutMs or null for none

Returns
Type Description
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
Name Description
maxResultPerPage Integer
Returns
Type Description
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
Name Description
maxResults Long

maxResults or null for none

Returns
Type Description
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
Name Description
maximumBillingTier Integer

maximum billing tier for this job

Returns
Type Description
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
Name Description
maximumBytesBilled Long

maximum bytes billed for this job

Returns
Type Description
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
Name Description
minResultSize Integer

minResultSize

Returns
Type Description
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
Name Description
numBufferedRows Integer

numBufferedRows or null for none

Returns
Type Description
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
Name Description
priority QueryJobConfiguration.Priority
Returns
Type Description
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
Name Description
rangePartitioning RangePartitioning

rangePartitioning or null for none

Returns
Type Description
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
Name Description
timeoutMs Long

or null for none

Returns
Type Description
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
Name Description
schemaUpdateOptions List<SchemaUpdateOption>
Returns
Type Description
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
Name Description
tableDefinitions Map<String,ExternalTableDefinition>
Returns
Type Description
ConnectionSettings.Builder

setTimePartitioning(TimePartitioning timePartitioning)

public abstract ConnectionSettings.Builder setTimePartitioning(TimePartitioning timePartitioning)

Sets the time partitioning specification for the destination table.

Parameter
Name Description
timePartitioning TimePartitioning
Returns
Type Description
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
Name Description
totalToPageRowCountRatio Integer

totalToPageRowCountRatio

Returns
Type Description
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
Name Description
useQueryCache Boolean
Returns
Type Description
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
Name Description
useReadAPI Boolean

or true for none

Returns
Type Description
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
Name Description
userDefinedFunctions List<UserDefinedFunction>
Returns
Type Description
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
Name Description
writeDisposition JobInfo.WriteDisposition
Returns
Type Description
ConnectionSettings.Builder