Package com.google.cloud.bigquery
Class ExternalTableDefinition.Builder
java.lang.Object
com.google.cloud.bigquery.TableDefinition.Builder<ExternalTableDefinition,ExternalTableDefinition.Builder>
com.google.cloud.bigquery.ExternalTableDefinition.Builder
- Enclosing class:
- ExternalTableDefinition
public abstract static class ExternalTableDefinition.Builder
extends TableDefinition.Builder<ExternalTableDefinition,ExternalTableDefinition.Builder>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract ExternalTableDefinitionbuild()Creates anExternalTableDefinitionobject.abstract ExternalTableDefinition.BuildersetAutodetect(Boolean autodetect) [Experimental] Sets detection of schema and format options automatically.abstract ExternalTableDefinition.BuildersetCompression(String compression) Sets compression type of the data source.abstract ExternalTableDefinition.BuildersetConnectionId(String connectionId) [Optional, Trusted Tester] connectionId for external data source.abstract ExternalTableDefinition.BuildersetDateFormat(String dateFormat) Format used to parse DATE values.abstract ExternalTableDefinition.BuildersetDatetimeFormat(String datetimeFormat) Format used to parse DATETIME values.abstract ExternalTableDefinition.BuildersetDecimalTargetTypes(List<String> decimalTargetTypes) Defines the list of possible SQL data types to which the source decimal values are converted.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) Sets the table Hive partitioning options.abstract ExternalTableDefinition.BuildersetIgnoreUnknownValues(Boolean ignoreUnknownValues) Sets whether BigQuery should allow extra values that are not represented in the table schema.abstract ExternalTableDefinition.BuildersetMaxBadRecords(Integer maxBadRecords) Sets the maximum number of bad records that BigQuery can ignore when reading data.setMaxStaleness(String maxStaleness) [Optional] Metadata Cache Mode for the table.setMetadataCacheMode(String metadataCacheMode) [Optional] Metadata Cache Mode for the table.abstract ExternalTableDefinition.BuildersetNullMarkers(List<String> nullMarkers) A list of strings represented as SQL NULL value in a CSV file. null_marker and null_markers can't be set at the same time.setObjectMetadata(String objectMetadata) abstract ExternalTableDefinition.BuildersetReferenceFileSchemaUri(String referenceFileSchemaUri) When creating an external table, the user can provide a reference file with the table schema.abstract ExternalTableDefinition.BuilderSets the table schema.abstract ExternalTableDefinition.BuildersetSourceColumnMatch(ExternalTableDefinition.SourceColumnMatch sourceColumnMatch) Controls the strategy used to match loaded columns to the schema.setSourceUris(List<String> sourceUris) Sets the fully-qualified URIs that point to your data in Google Cloud Storage (e.g.abstract ExternalTableDefinition.BuildersetTimeFormat(String timeFormat) Format used to parse TIME values.abstract ExternalTableDefinition.BuildersetTimestampFormat(String timestampFormat) Format used to parse TIMESTAMP values.abstract ExternalTableDefinition.BuildersetTimeZone(String timeZone) Time zone used when parsing timestamp values that do not have specific time zone information (e.g. 2024-04-20 12:34:56).abstract ExternalTableDefinition.BuildersetType(TableDefinition.Type type)
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
setSourceUris
Sets the fully-qualified URIs that point to your data in Google Cloud Storage (e.g. gs://bucket/path). Each URI can contain one '*' wildcard character that must come after the bucket's name. Size limits related to load jobs apply to external data sources, plus an additional limit of 10 GB maximum size across all URIs.For Google Cloud Bigtable URIs: Exactly one URI can be specified and it has be a fully specified and valid HTTPS URL for a Google Cloud Bigtable table.
For Google Cloud Datastore backup URIs: Exactly one URI can be specified. Also, the '*' wildcard character is not allowed.
- See Also:
-
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. -
setFormatOptions
Sets the source format, and possibly some parsing options, of the external data. Supported formats areCSVandNEWLINE_DELIMITED_JSON. -
setDecimalTargetTypes
public abstract ExternalTableDefinition.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.- Parameters:
decimalTargetTypes- decimalTargetType ornullfor none
-
setMaxBadRecords
Sets the maximum number of bad records that BigQuery can ignore when reading data. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid. -
setIgnoreUnknownValues
Sets whether BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, 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. The default value is false. The value set withsetFormatOptions(FormatOptions)property determines what BigQuery treats as an extra value.- See Also:
-
setCompression
Sets compression type of the data source. By default no compression is assumed.- See Also:
-
setConnectionId
[Optional, Trusted Tester] connectionId for external data source. The value may benull. -
setAutodetect
[Experimental] Sets detection of schema and format options automatically. Any option specified explicitly will be honored. -
setType
- Specified by:
setTypein classTableDefinition.Builder<ExternalTableDefinition,ExternalTableDefinition.Builder>
-
setSchema
Sets the table schema.- Specified by:
setSchemain classTableDefinition.Builder<ExternalTableDefinition,ExternalTableDefinition.Builder>
-
setHivePartitioningOptions
public ExternalTableDefinition.Builder setHivePartitioningOptions(HivePartitioningOptions hivePartitioningOptions) Sets the table Hive partitioning options. -
setReferenceFileSchemaUri
public abstract ExternalTableDefinition.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- ornullfor none
-
setObjectMetadata
-
setMetadataCacheMode
[Optional] Metadata Cache Mode for the table. Set this to enable caching of metadata from external data source.- See Also:
-
setMaxStaleness
[Optional] Metadata Cache Mode for the table. Set this to enable caching of metadata from external data source.- See Also:
-
setTimeZone
Time zone used when parsing timestamp values that do not have specific time zone information (e.g. 2024-04-20 12:34:56). The expected format is a IANA timezone string (e.g. America/Los_Angeles). -
setDateFormat
Format used to parse DATE values. Supports C-style and SQL-style values. -
setDatetimeFormat
Format used to parse DATETIME values. Supports C-style and SQL-style values. -
setTimeFormat
Format used to parse TIME values. Supports C-style and SQL-style values. -
setTimestampFormat
Format used to parse TIMESTAMP values. Supports C-style and SQL-style values. -
setSourceColumnMatch
public abstract ExternalTableDefinition.Builder setSourceColumnMatch(ExternalTableDefinition.SourceColumnMatch sourceColumnMatch) Controls the strategy used to match loaded columns to the schema. If not set, a sensible default is chosen based on how the schema is provided. If autodetect is used, then columns are matched by name. Otherwise, columns are matched by position. This is done to keep the behavior backward-compatible. Acceptable values are: POSITION - matches by position. This assumes that the columns are ordered the same way as the schema. NAME - matches by name. This reads the header row as column names and reorders columns to match the field names in the schema. -
setNullMarkers
A list of strings represented as SQL NULL value in a CSV file. null_marker and null_markers can't be set at the same time. If null_marker is set, null_markers has to be not set. If null_markers is set, null_marker has to be not set. If both null_marker and null_markers are set at the same time, a user error would be thrown. Any strings listed in null_markers, including empty string would be interpreted as SQL NULL. This applies to all column types. -
build
Creates anExternalTableDefinitionobject.- Specified by:
buildin classTableDefinition.Builder<ExternalTableDefinition,ExternalTableDefinition.Builder>
-