Google Cloud Dataflow SDK for Java, version 1.9.1
com.google.cloud.dataflow.sdk.io
Class BigQueryIO.Read
- java.lang.Object
-
- com.google.cloud.dataflow.sdk.io.BigQueryIO.Read
-
- Enclosing class:
- BigQueryIO
public static class BigQueryIO.Read extends Object
APTransform
that reads from a BigQuery table and returns aPCollection
ofTableRows
containing each of the rows of the table.Each
TableRow
contains values indexed by column name. Here is a sample processing function that processes a "line" column from rows:static class ExtractWordsFn extends DoFn<TableRow, String> { public void processElement(ProcessContext c) { // Get the "line" field of the TableRow object, split it into words, and emit them. TableRow row = c.element(); String[] words = row.get("line").toString().split("[^a-zA-Z']+"); for (String word : words) { if (!word.isEmpty()) { c.output(word); } } } }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static class
BigQueryIO.Read.Bound
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static BigQueryIO.Read.Bound
from(String tableSpec)
Reads a BigQuery table specified as"[project_id]:[dataset_id].[table_id]"
or"[dataset_id].[table_id]"
for tables within the current project.static BigQueryIO.Read.Bound
from(TableReference table)
Reads a BigQuery table specified as aTableReference
object.static BigQueryIO.Read.Bound
from(ValueProvider<String> tableSpec)
Same asfrom(String)
, but with aValueProvider
.static BigQueryIO.Read.Bound
fromQuery(String query)
Reads results received after executing the given query.static BigQueryIO.Read.Bound
fromQuery(ValueProvider<String> query)
Same asfrom(String)
, but with aValueProvider
.static BigQueryIO.Read.Bound
named(String name)
Returns aBigQueryIO.Read.Bound
with the given name.static BigQueryIO.Read.Bound
withoutValidation()
Disables BigQuery table validation, which is enabled by default.
-
-
-
Method Detail
-
named
public static BigQueryIO.Read.Bound named(String name)
Returns aBigQueryIO.Read.Bound
with the given name. The BigQuery table or query to be read from has not yet been configured.
-
from
public static BigQueryIO.Read.Bound from(String tableSpec)
Reads a BigQuery table specified as"[project_id]:[dataset_id].[table_id]"
or"[dataset_id].[table_id]"
for tables within the current project.
-
from
public static BigQueryIO.Read.Bound from(ValueProvider<String> tableSpec)
Same asfrom(String)
, but with aValueProvider
.
-
fromQuery
public static BigQueryIO.Read.Bound fromQuery(String query)
Reads results received after executing the given query.
-
fromQuery
public static BigQueryIO.Read.Bound fromQuery(ValueProvider<String> query)
Same asfrom(String)
, but with aValueProvider
.
-
from
public static BigQueryIO.Read.Bound from(TableReference table)
Reads a BigQuery table specified as aTableReference
object.
-
withoutValidation
public static BigQueryIO.Read.Bound withoutValidation()
Disables BigQuery table validation, which is enabled by default.
-
-