Class BigQuerySchemaIOProvider
java.lang.Object
org.apache.beam.sdk.io.gcp.bigquery.BigQuerySchemaIOProvider
- All Implemented Interfaces:
SchemaIOProvider
@Internal
@AutoService(SchemaIOProvider.class)
public class BigQuerySchemaIOProvider
extends Object
implements SchemaIOProvider
An implementation of
SchemaIOProvider
for reading and writing to BigQuery with BigQueryIO
. For a description of configuration options and other defaults, see configurationSchema()
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the expected schema of the configuration object.org.apache.beam.sdk.io.gcp.bigquery.BigQuerySchemaIOProvider.BigQuerySchemaIO
Produces a SchemaIO given a String representing the data's location, the schema of the data that resides there, and some IO-specific configuration object.Returns an id that uniquely represents this IO.Indicates whether the PCollections produced by this transform will contain a bounded or unbounded number of elements.boolean
Indicates whether this transform requires a specified data schema.
-
Constructor Details
-
BigQuerySchemaIOProvider
public BigQuerySchemaIOProvider()
-
-
Method Details
-
identifier
Returns an id that uniquely represents this IO.- Specified by:
identifier
in interfaceSchemaIOProvider
-
configurationSchema
Returns the expected schema of the configuration object. Note this is distinct from the schema of the data source itself. The fields are as follows:- table: Nullable String - Used for reads and writes. Specifies a table to read or write
to, in the format described in
BigQueryHelpers.parseTableSpec(java.lang.String)
. Used as an input toBigQueryIO.TypedRead.from(String)
orBigQueryIO.Write.to(String)
. - query: Nullable String - Used for reads. Specifies a query to read results from using the
BigQuery Standard SQL dialect. Used as an input to
BigQueryIO.TypedRead.fromQuery(String)
. - queryLocation: Nullable String - Used for reads. Specifies a BigQuery geographic location
where the query job will be executed. Used as an input to
BigQueryIO.TypedRead.withQueryLocation(String)
. - createDisposition: Nullable String - Used for writes. Specifies whether a table should be
created if it does not exist. Valid inputs are "Never" and "IfNeeded", corresponding to
values of
BigQueryIO.Write.CreateDisposition
. Used as an input toBigQueryIO.Write.withCreateDisposition(BigQueryIO.Write.CreateDisposition)
.
- ReadMethod - The input to
BigQueryIO.TypedRead.withMethod(BigQueryIO.TypedRead.Method)
. Defaults to EXPORT, since that is the only method that currently offers Beam Schema support. - WriteMethod - The input to
BigQueryIO.Write.withMethod(BigQueryIO.Write.Method)
. Currently defaults to STORAGE_WRITE_API.
- Specified by:
configurationSchema
in interfaceSchemaIOProvider
- table: Nullable String - Used for reads and writes. Specifies a table to read or write
to, in the format described in
-
from
public org.apache.beam.sdk.io.gcp.bigquery.BigQuerySchemaIOProvider.BigQuerySchemaIO from(String location, Row configuration, @Nullable Schema dataSchema) Produces a SchemaIO given a String representing the data's location, the schema of the data that resides there, and some IO-specific configuration object.For BigQuery IO, only the configuration object is used. Location and data schema have no effect. Specifying a table and dataset is done through appropriate fields in the configuration object, and the data schema is automatically generated from either the input PCollection or schema of the BigQuery table.
- Specified by:
from
in interfaceSchemaIOProvider
-
requiresDataSchema
public boolean requiresDataSchema()Indicates whether this transform requires a specified data schema.- Specified by:
requiresDataSchema
in interfaceSchemaIOProvider
- Returns:
- false
-
isBounded
Indicates whether the PCollections produced by this transform will contain a bounded or unbounded number of elements.- Specified by:
isBounded
in interfaceSchemaIOProvider
- Returns:
- Bounded
-