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
Modifier and TypeMethodDescriptionbuild()Creates an object.setAutodetect(Boolean autodetect) Sets automatic inference of the options and schema for CSV and JSON sources.setClustering(Clustering clustering) Sets the clustering specification for the destination table.setColumnNameCharacterMap(String columnNameCharacterMap) [Optional] Character map supported for column names in CSV/Parquet loads.setConnectionProperties(List<ConnectionProperty> connectionProperties) setCreateDisposition(JobInfo.CreateDisposition createDisposition) Sets whether the job is allowed to create new tables.setCreateSession(Boolean createSession) setDecimalTargetTypes(List<String> decimalTargetTypes) Defines the list of possible SQL data types to which the source decimal values are converted.setDestinationEncryptionConfiguration(EncryptionConfiguration encryptionConfiguration) setDestinationTable(TableId destinationTable) Sets the destination table to load the data into.setFileSetSpecType(String fileSetSpecType) Defines how to interpret files denoted by URIs.setFormatOptions(FormatOptions formatOptions) Sets the source format, and possibly some parsing options, of the external data.setHivePartitioningOptions(HivePartitioningOptions hivePartitioningOptions) setIgnoreUnknownValues(Boolean ignoreUnknownValues) Sets whether BigQuery should allow extra values that are not represented in the table schema.setJobTimeoutMs(Long jobTimeoutMs) [Optional] Job timeout in milliseconds.The labels associated with this job.setMaxBadRecords(Integer maxBadRecords) Sets the maximum number of bad records that BigQuery can ignore when running the job.setNullMarker(String nullMarker) Sets the string that represents a null value in a CSV file.setRangePartitioning(RangePartitioning rangePartitioning) Range partitioning specification for this table.setReferenceFileSchemaUri(String referenceFileSchemaUri) When creating an external table, the user can provide a reference file with the table schema.Sets the schema for the destination table.setSchemaUpdateOptions(List<JobInfo.SchemaUpdateOption> schemaUpdateOptions) Sets options allowing the schema of the destination table to be updated as a side effect of the load job.setSourceUris(List<String> sourceUris) Sets the fully-qualified URIs that point to source data in Google Cloud Storage (e.g.setTimePartitioning(TimePartitioning timePartitioning) Sets the time partitioning specification for the destination table.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).setWriteDisposition(JobInfo.WriteDisposition writeDisposition) Sets the action that should occur if the destination table already exists.
-
Method Details
-
setDestinationTable
Description copied from interface:LoadConfiguration.BuilderSets the destination table to load the data into.- Specified by:
setDestinationTablein interfaceLoadConfiguration.Builder
-
setDestinationEncryptionConfiguration
public LoadJobConfiguration.Builder setDestinationEncryptionConfiguration(EncryptionConfiguration encryptionConfiguration) - Specified by:
setDestinationEncryptionConfigurationin interfaceLoadConfiguration.Builder
-
setCreateDisposition
public LoadJobConfiguration.Builder setCreateDisposition(JobInfo.CreateDisposition createDisposition) Description copied from interface:LoadConfiguration.BuilderSets whether the job is allowed to create new tables.- Specified by:
setCreateDispositionin interfaceLoadConfiguration.Builder- See Also:
-
setWriteDisposition
Description copied from interface:LoadConfiguration.BuilderSets the action that should occur if the destination table already exists.- Specified by:
setWriteDispositionin interfaceLoadConfiguration.Builder- See Also:
-
setFormatOptions
Description copied from interface:LoadConfiguration.BuilderSets the source format, and possibly some parsing options, of the external data. Supported formats areCSV,NEWLINE_DELIMITED_JSONandDATASTORE_BACKUP. If not specified,CSVformat is assumed.- Specified by:
setFormatOptionsin interfaceLoadConfiguration.Builder
-
setNullMarker
Description copied from interface:LoadConfiguration.BuilderSets 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 forSTRINGandBYTE. ForSTRINGandBYTEcolumns, BigQuery interprets the empty string as an empty value.- Specified by:
setNullMarkerin interfaceLoadConfiguration.Builder
-
setMaxBadRecords
Description copied from interface:LoadConfiguration.BuilderSets 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:
setMaxBadRecordsin interfaceLoadConfiguration.Builder
-
setSchema
Description copied from interface:LoadConfiguration.BuilderSets 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_BACKUPformat option).- Specified by:
setSchemain interfaceLoadConfiguration.Builder
-
setIgnoreUnknownValues
Description copied from interface:LoadConfiguration.BuilderSets 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:
setIgnoreUnknownValuesin interfaceLoadConfiguration.Builder
-
setTimePartitioning
Description copied from interface:LoadConfiguration.BuilderSets the time partitioning specification for the destination table.- Specified by:
setTimePartitioningin interfaceLoadConfiguration.Builder
-
setClustering
Description copied from interface:LoadConfiguration.BuilderSets the clustering specification for the destination table.- Specified by:
setClusteringin interfaceLoadConfiguration.Builder
-
setUseAvroLogicalTypes
Description copied from interface:LoadConfiguration.BuilderIf 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:
setUseAvroLogicalTypesin interfaceLoadConfiguration.Builder
-
setSourceUris
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. -
setFileSetSpecType
Defines how to interpret files denoted by URIs. By default the files are assumed to be data files (this can be specified explicitly via FILE_SET_SPEC_TYPE_FILE_SYSTEM_MATCH). A second option is "FILE_SET_SPEC_TYPE_NEW_LINE_DELIMITED_MANIFEST" which interprets each file as a manifest file, where each line is a reference to a file. -
setColumnNameCharacterMap
[Optional] Character map supported for column names in CSV/Parquet loads. Defaults to STRICT and can be overridden by Project Config Service. Using this option with unsupporting load formats will result in an error.- See Also:
-
setDecimalTargetTypes
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:
setDecimalTargetTypesin interfaceLoadConfiguration.Builder- Parameters:
decimalTargetTypes- decimalTargetType ornullfor none
-
setAutodetect
Description copied from interface:LoadConfiguration.BuilderSets automatic inference of the options and schema for CSV and JSON sources.- Specified by:
setAutodetectin interfaceLoadConfiguration.Builder
-
setSchemaUpdateOptions
public LoadJobConfiguration.Builder setSchemaUpdateOptions(List<JobInfo.SchemaUpdateOption> schemaUpdateOptions) Description copied from interface:LoadConfiguration.BuilderSets 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:
setSchemaUpdateOptionsin interfaceLoadConfiguration.Builder
-
setLabels
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 ornullfor none
-
setJobTimeoutMs
[Optional] Job timeout in milliseconds. If this time limit is exceeded, BigQuery may attempt to terminate the job.- Parameters:
jobTimeoutMs- jobTimeoutMs ornullfor none
-
setRangePartitioning
Range partitioning specification for this table. Only one of timePartitioning and rangePartitioning should be specified.- Parameters:
rangePartitioning- rangePartitioning ornullfor none
-
setHivePartitioningOptions
public LoadJobConfiguration.Builder setHivePartitioningOptions(HivePartitioningOptions hivePartitioningOptions) -
setReferenceFileSchemaUri
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- ornullfor none
-
setConnectionProperties
public LoadJobConfiguration.Builder setConnectionProperties(List<ConnectionProperty> connectionProperties) -
setCreateSession
-
build
Description copied from class:JobConfiguration.BuilderCreates an object.- Specified by:
buildin interfaceLoadConfiguration.Builder- Specified by:
buildin classJobConfiguration.Builder<LoadJobConfiguration,LoadJobConfiguration.Builder>
-