BigQueryIO.Write (Google Cloud Dataflow SDK 1.9.1 API)

Google Cloud Dataflow SDK for Java, version 1.9.1

com.google.cloud.dataflow.sdk.io

Class BigQueryIO.Write

  • Enclosing class:
    BigQueryIO


    public static class BigQueryIO.Write
    extends Object
    A PTransform that writes a PCollection containing TableRows to a BigQuery table.

    In BigQuery, each table has an enclosing dataset. The dataset being written must already exist.

    By default, tables will be created if they do not exist, which corresponds to a BigQueryIO.Write.CreateDisposition.CREATE_IF_NEEDED disposition that matches the default of BigQuery's Jobs API. A schema must be provided (via withSchema(TableSchema)), or else the transform may fail at runtime with an IllegalArgumentException.

    By default, writes require an empty table, which corresponds to a BigQueryIO.Write.WriteDisposition.WRITE_EMPTY disposition that matches the default of BigQuery's Jobs API.

    Here is a sample transform that produces TableRow values containing "word" and "count" columns:

    
     static class FormatCountsFn extends DoFn<KV<String, Long>, TableRow> {
       public void processElement(ProcessContext c) {
         TableRow row = new TableRow()
             .set("word", c.element().getKey())
             .set("count", c.element().getValue().intValue());
         c.output(row);
       }
     }


이 페이지가 도움이 되었나요? 평가를 부탁드립니다.

다음에 대한 의견 보내기...

도움이 필요하시나요? 지원 페이지를 방문하세요.