Package com.google.cloud.bigquery
Class WriteChannelConfiguration.Builder
- java.lang.Object
-
- com.google.cloud.bigquery.WriteChannelConfiguration.Builder
-
- All Implemented Interfaces:
LoadConfiguration.Builder
- Enclosing class:
- WriteChannelConfiguration
public static final class WriteChannelConfiguration.Builder extends Object implements LoadConfiguration.Builder
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WriteChannelConfigurationbuild()WriteChannelConfiguration.BuildersetAutodetect(Boolean autodetect)[Experimental] Sets automatic inference of the options and schema for CSV and JSON sources.WriteChannelConfiguration.BuildersetClustering(Clustering clustering)Sets the clustering specification for the destination table.WriteChannelConfiguration.BuildersetConnectionProperties(List<ConnectionProperty> connectionProperties)WriteChannelConfiguration.BuildersetCreateDisposition(JobInfo.CreateDisposition createDisposition)Sets whether the job is allowed to create new tables.WriteChannelConfiguration.BuildersetCreateSession(Boolean createSession)WriteChannelConfiguration.BuildersetDecimalTargetTypes(List<String> decimalTargetTypes)Defines the list of possible SQL data types to which the source decimal values are converted.LoadConfiguration.BuildersetDestinationEncryptionConfiguration(EncryptionConfiguration encryptionConfiguration)WriteChannelConfiguration.BuildersetDestinationTable(TableId destinationTable)Sets the destination table to load the data into.WriteChannelConfiguration.BuildersetFormatOptions(FormatOptions formatOptions)Sets the source format, and possibly some parsing options, of the external data.WriteChannelConfiguration.BuildersetIgnoreUnknownValues(Boolean ignoreUnknownValues)Sets whether BigQuery should allow extra values that are not represented in the table schema.WriteChannelConfiguration.BuildersetLabels(Map<String,String> labels)WriteChannelConfiguration.BuildersetMaxBadRecords(Integer maxBadRecords)Sets the maximum number of bad records that BigQuery can ignore when running the job.WriteChannelConfiguration.BuildersetNullMarker(String nullMarker)Sets the string that represents a null value in a CSV file.WriteChannelConfiguration.BuildersetSchema(Schema schema)Sets the schema for the destination table.WriteChannelConfiguration.BuildersetSchemaUpdateOptions(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.WriteChannelConfiguration.BuildersetTimePartitioning(TimePartitioning timePartitioning)Sets the time partitioning specification for the destination table.WriteChannelConfiguration.BuildersetUseAvroLogicalTypes(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).WriteChannelConfiguration.BuildersetWriteDisposition(JobInfo.WriteDisposition writeDisposition)Sets the action that should occur if the destination table already exists.
-
-
-
Method Detail
-
setDestinationTable
public WriteChannelConfiguration.Builder setDestinationTable(TableId destinationTable)
Description copied from interface:LoadConfiguration.BuilderSets the destination table to load the data into.- Specified by:
setDestinationTablein interfaceLoadConfiguration.Builder
-
setDestinationEncryptionConfiguration
public LoadConfiguration.Builder setDestinationEncryptionConfiguration(EncryptionConfiguration encryptionConfiguration)
- Specified by:
setDestinationEncryptionConfigurationin interfaceLoadConfiguration.Builder
-
setCreateDisposition
public WriteChannelConfiguration.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:
- Create Disposition
-
setWriteDisposition
public WriteChannelConfiguration.Builder setWriteDisposition(JobInfo.WriteDisposition writeDisposition)
Description copied from interface:LoadConfiguration.BuilderSets the action that should occur if the destination table already exists.- Specified by:
setWriteDispositionin interfaceLoadConfiguration.Builder- See Also:
- Write Disposition
-
setFormatOptions
public WriteChannelConfiguration.Builder setFormatOptions(FormatOptions formatOptions)
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
public WriteChannelConfiguration.Builder setNullMarker(String nullMarker)
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
public WriteChannelConfiguration.Builder setMaxBadRecords(Integer maxBadRecords)
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
public WriteChannelConfiguration.Builder setSchema(Schema schema)
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
public WriteChannelConfiguration.Builder setIgnoreUnknownValues(Boolean ignoreUnknownValues)
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
-
setSchemaUpdateOptions
public WriteChannelConfiguration.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:
setSchemaUpdateOptionsin interfaceLoadConfiguration.Builder
-
setAutodetect
public WriteChannelConfiguration.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:
setAutodetectin interfaceLoadConfiguration.Builder
-
setTimePartitioning
public WriteChannelConfiguration.Builder setTimePartitioning(TimePartitioning timePartitioning)
Description copied from interface:LoadConfiguration.BuilderSets the time partitioning specification for the destination table.- Specified by:
setTimePartitioningin interfaceLoadConfiguration.Builder
-
setClustering
public WriteChannelConfiguration.Builder setClustering(Clustering clustering)
Description copied from interface:LoadConfiguration.BuilderSets the clustering specification for the destination table.- Specified by:
setClusteringin interfaceLoadConfiguration.Builder
-
setUseAvroLogicalTypes
public WriteChannelConfiguration.Builder setUseAvroLogicalTypes(Boolean useAvroLogicalTypes)
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
-
setLabels
public WriteChannelConfiguration.Builder setLabels(Map<String,String> labels)
-
setDecimalTargetTypes
public WriteChannelConfiguration.Builder setDecimalTargetTypes(List<String> decimalTargetTypes)
Description copied from interface:LoadConfiguration.BuilderDefines 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
-
setConnectionProperties
public WriteChannelConfiguration.Builder setConnectionProperties(List<ConnectionProperty> connectionProperties)
-
setCreateSession
public WriteChannelConfiguration.Builder setCreateSession(Boolean createSession)
-
build
public WriteChannelConfiguration build()
- Specified by:
buildin interfaceLoadConfiguration.Builder
-
-