Package com.google.cloud.bigquery
Class LoadJobConfiguration.Builder
- java.lang.Object
-
- com.google.cloud.bigquery.JobConfiguration.Builder<LoadJobConfiguration,LoadJobConfiguration.Builder>
-
- com.google.cloud.bigquery.LoadJobConfiguration.Builder
-
- All Implemented Interfaces:
LoadConfiguration.Builder
- Enclosing class:
- LoadJobConfiguration
public static final class LoadJobConfiguration.Builder extends JobConfiguration.Builder<LoadJobConfiguration,LoadJobConfiguration.Builder> implements LoadConfiguration.Builder
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LoadJobConfiguration
build()
Creates an object.LoadJobConfiguration.Builder
setAutodetect(Boolean autodetect)
[Experimental] Sets automatic inference of the options and schema for CSV and JSON sources.LoadJobConfiguration.Builder
setClustering(Clustering clustering)
Sets the clustering specification for the destination table.LoadJobConfiguration.Builder
setConnectionProperties(List<ConnectionProperty> connectionProperties)
LoadJobConfiguration.Builder
setCreateDisposition(JobInfo.CreateDisposition createDisposition)
Sets whether the job is allowed to create new tables.LoadJobConfiguration.Builder
setCreateSession(Boolean createSession)
LoadJobConfiguration.Builder
setDecimalTargetTypes(List<String> decimalTargetTypes)
Defines the list of possible SQL data types to which the source decimal values are converted.LoadJobConfiguration.Builder
setDestinationEncryptionConfiguration(EncryptionConfiguration encryptionConfiguration)
LoadJobConfiguration.Builder
setDestinationTable(TableId destinationTable)
Sets the destination table to load the data into.LoadJobConfiguration.Builder
setFormatOptions(FormatOptions formatOptions)
Sets the source format, and possibly some parsing options, of the external data.LoadJobConfiguration.Builder
setHivePartitioningOptions(HivePartitioningOptions hivePartitioningOptions)
LoadJobConfiguration.Builder
setIgnoreUnknownValues(Boolean ignoreUnknownValues)
Sets whether BigQuery should allow extra values that are not represented in the table schema.LoadJobConfiguration.Builder
setJobTimeoutMs(Long jobTimeoutMs)
[Optional] Job timeout in milliseconds.LoadJobConfiguration.Builder
setLabels(Map<String,String> labels)
The labels associated with this job.LoadJobConfiguration.Builder
setMaxBadRecords(Integer maxBadRecords)
Sets the maximum number of bad records that BigQuery can ignore when running the job.LoadJobConfiguration.Builder
setNullMarker(String nullMarker)
Sets the string that represents a null value in a CSV file.LoadJobConfiguration.Builder
setRangePartitioning(RangePartitioning rangePartitioning)
Range partitioning specification for this table.LoadJobConfiguration.Builder
setReferenceFileSchemaUri(String referenceFileSchemaUri)
When creating an external table, the user can provide a reference file with the table schema.LoadJobConfiguration.Builder
setSchema(Schema schema)
Sets the schema for the destination table.LoadJobConfiguration.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 load job.LoadJobConfiguration.Builder
setSourceUris(List<String> sourceUris)
Sets the fully-qualified URIs that point to source data in Google Cloud Storage (e.g.LoadJobConfiguration.Builder
setTimePartitioning(TimePartitioning timePartitioning)
Sets the time partitioning specification for the destination table.LoadJobConfiguration.Builder
setUseAvroLogicalTypes(Boolean useAvroLogicalTypes)
If FormatOptions is set to AVRO, you can interpret logical types into their corresponding types (such as TIMESTAMP) instead of only using their raw types (such as INTEGER).LoadJobConfiguration.Builder
setWriteDisposition(JobInfo.WriteDisposition writeDisposition)
Sets the action that should occur if the destination table already exists.
-
-
-
Method Detail
-
setDestinationTable
public LoadJobConfiguration.Builder setDestinationTable(TableId destinationTable)
Description copied from interface:LoadConfiguration.Builder
Sets the destination table to load the data into.- Specified by:
setDestinationTable
in interfaceLoadConfiguration.Builder
-
setDestinationEncryptionConfiguration
public LoadJobConfiguration.Builder setDestinationEncryptionConfiguration(EncryptionConfiguration encryptionConfiguration)
- Specified by:
setDestinationEncryptionConfiguration
in interfaceLoadConfiguration.Builder
-
setCreateDisposition
public LoadJobConfiguration.Builder setCreateDisposition(JobInfo.CreateDisposition createDisposition)
Description copied from interface:LoadConfiguration.Builder
Sets whether the job is allowed to create new tables.- Specified by:
setCreateDisposition
in interfaceLoadConfiguration.Builder
- See Also:
- Create Disposition
-
setWriteDisposition
public LoadJobConfiguration.Builder setWriteDisposition(JobInfo.WriteDisposition writeDisposition)
Description copied from interface:LoadConfiguration.Builder
Sets the action that should occur if the destination table already exists.- Specified by:
setWriteDisposition
in interfaceLoadConfiguration.Builder
- See Also:
- Write Disposition
-
setFormatOptions
public LoadJobConfiguration.Builder setFormatOptions(FormatOptions formatOptions)
Description copied from interface:LoadConfiguration.Builder
Sets the source format, and possibly some parsing options, of the external data. Supported formats areCSV
,NEWLINE_DELIMITED_JSON
andDATASTORE_BACKUP
. If not specified,CSV
format is assumed.- Specified by:
setFormatOptions
in interfaceLoadConfiguration.Builder
-
setNullMarker
public LoadJobConfiguration.Builder setNullMarker(String nullMarker)
Description copied from interface:LoadConfiguration.Builder
Sets the string that represents a null value in a CSV file. For example, if you specify "\N", BigQuery interprets "\N" as a null value when loading a CSV file. The default value is the empty string. If you set this property to a custom value, BigQuery throws an error if an empty string is present for all data types except forSTRING
andBYTE
. ForSTRING
andBYTE
columns, BigQuery interprets the empty string as an empty value.- Specified by:
setNullMarker
in interfaceLoadConfiguration.Builder
-
setMaxBadRecords
public LoadJobConfiguration.Builder setMaxBadRecords(Integer maxBadRecords)
Description copied from interface:LoadConfiguration.Builder
Sets the maximum number of bad records that BigQuery can ignore when running the job. If the number of bad records exceeds this value, an invalid error is returned in the job result. By default no bad record is ignored.- Specified by:
setMaxBadRecords
in interfaceLoadConfiguration.Builder
-
setSchema
public LoadJobConfiguration.Builder setSchema(Schema schema)
Description copied from interface:LoadConfiguration.Builder
Sets the schema for the destination table. The schema can be omitted if the destination table already exists, or if you're loading data from a Google Cloud Datastore backup (i.e.DATASTORE_BACKUP
format option).- Specified by:
setSchema
in interfaceLoadConfiguration.Builder
-
setIgnoreUnknownValues
public LoadJobConfiguration.Builder setIgnoreUnknownValues(Boolean ignoreUnknownValues)
Description copied from interface:LoadConfiguration.Builder
Sets whether BigQuery should allow extra values that are not represented in the table schema. Iftrue
, the extra values are ignored. Iffalse
, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. By default unknown values are not allowed.- Specified by:
setIgnoreUnknownValues
in interfaceLoadConfiguration.Builder
-
setTimePartitioning
public LoadJobConfiguration.Builder setTimePartitioning(TimePartitioning timePartitioning)
Description copied from interface:LoadConfiguration.Builder
Sets the time partitioning specification for the destination table.- Specified by:
setTimePartitioning
in interfaceLoadConfiguration.Builder
-
setClustering
public LoadJobConfiguration.Builder setClustering(Clustering clustering)
Description copied from interface:LoadConfiguration.Builder
Sets the clustering specification for the destination table.- Specified by:
setClustering
in interfaceLoadConfiguration.Builder
-
setUseAvroLogicalTypes
public LoadJobConfiguration.Builder setUseAvroLogicalTypes(Boolean useAvroLogicalTypes)
Description copied from interface:LoadConfiguration.Builder
If FormatOptions is set to AVRO, you can interpret logical types into their corresponding types (such as TIMESTAMP) instead of only using their raw types (such as INTEGER). The value may benull
.- Specified by:
setUseAvroLogicalTypes
in interfaceLoadConfiguration.Builder
-
setSourceUris
public LoadJobConfiguration.Builder setSourceUris(List<String> sourceUris)
Sets the fully-qualified URIs that point to source data in Google Cloud Storage (e.g. gs://bucket/path). Each URI can contain one '*' wildcard character and it must come after the 'bucket' name.
-
setDecimalTargetTypes
public LoadJobConfiguration.Builder setDecimalTargetTypes(List<String> decimalTargetTypes)
Defines the list of possible SQL data types to which the source decimal values are converted. This list and the precision and the scale parameters of the decimal field determine the target type. In the order of NUMERIC, BIGNUMERIC, and STRING, a type is picked if it is in the specified list and if it supports the precision and the scale. STRING supports all precision and scale values.- Specified by:
setDecimalTargetTypes
in interfaceLoadConfiguration.Builder
- Parameters:
decimalTargetTypes
- decimalTargetType ornull
for none
-
setAutodetect
public LoadJobConfiguration.Builder setAutodetect(Boolean autodetect)
Description copied from interface:LoadConfiguration.Builder
[Experimental] Sets automatic inference of the options and schema for CSV and JSON sources.- Specified by:
setAutodetect
in interfaceLoadConfiguration.Builder
-
setSchemaUpdateOptions
public LoadJobConfiguration.Builder setSchemaUpdateOptions(List<JobInfo.SchemaUpdateOption> schemaUpdateOptions)
Description copied from interface:LoadConfiguration.Builder
[Experimental] Sets options allowing the schema of the destination table to be updated as a side effect of the load 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.- Specified by:
setSchemaUpdateOptions
in interfaceLoadConfiguration.Builder
-
setLabels
public LoadJobConfiguration.Builder setLabels(Map<String,String> labels)
The labels associated with this job. You can use these to organize and group your jobs. Label keys and values can be no longer than 63 characters, can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter and each label in the list must have a different key.- Parameters:
labels
- labels ornull
for none
-
setJobTimeoutMs
public LoadJobConfiguration.Builder setJobTimeoutMs(Long jobTimeoutMs)
[Optional] Job timeout in milliseconds. If this time limit is exceeded, BigQuery may attempt to terminate the job.- Parameters:
jobTimeoutMs
- jobTimeoutMs ornull
for none
-
setRangePartitioning
public LoadJobConfiguration.Builder setRangePartitioning(RangePartitioning rangePartitioning)
Range partitioning specification for this table. Only one of timePartitioning and rangePartitioning should be specified.- Parameters:
rangePartitioning
- rangePartitioning ornull
for none
-
setHivePartitioningOptions
public LoadJobConfiguration.Builder setHivePartitioningOptions(HivePartitioningOptions hivePartitioningOptions)
-
setReferenceFileSchemaUri
public LoadJobConfiguration.Builder setReferenceFileSchemaUri(String referenceFileSchemaUri)
When creating an external table, the user can provide a reference file with the table schema. This is enabled for the following formats: AVRO, PARQUET, ORC.- Parameters:
referenceFileSchemaUri
- ornull
for none
-
setConnectionProperties
public LoadJobConfiguration.Builder setConnectionProperties(List<ConnectionProperty> connectionProperties)
-
setCreateSession
public LoadJobConfiguration.Builder setCreateSession(Boolean createSession)
-
build
public LoadJobConfiguration build()
Description copied from class:JobConfiguration.Builder
Creates an object.- Specified by:
build
in interfaceLoadConfiguration.Builder
- Specified by:
build
in classJobConfiguration.Builder<LoadJobConfiguration,LoadJobConfiguration.Builder>
-
-