Class WriteToBigQuery<InputT>

  • All Implemented Interfaces:
    java.io.Serializable, org.apache.beam.sdk.transforms.display.HasDisplayData
    Direct Known Subclasses:
    WriteWindowedToBigQuery

    public class WriteToBigQuery<InputT>
    extends org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PCollection<InputT>,​org.apache.beam.sdk.values.PDone>
    Generate, format, and write BigQuery table row information. Use provided information about the field names and types, as well as lambda functions that describe how to generate their values.
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      protected class  WriteToBigQuery.BuildRowFn
      Convert each key/score pair into a BigQuery TableRow as specified by fieldFn.
      static interface  WriteToBigQuery.FieldFn<InputT>
      A Serializable function from a DoFn.ProcessContext and BoundedWindow to the value for that field.
      static class  WriteToBigQuery.FieldInfo<InputT>
      Define a class to hold information about output table field definitions.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String datasetId  
      protected java.util.Map<java.lang.String,​WriteToBigQuery.FieldInfo<InputT>> fieldInfo  
      protected java.lang.String projectId  
      protected java.lang.String tableName  
      • Fields inherited from class org.apache.beam.sdk.transforms.PTransform

        annotations, displayData, name, resourceHints
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.beam.sdk.values.PDone expand​(org.apache.beam.sdk.values.PCollection<InputT> teamAndScore)  
      protected com.google.api.services.bigquery.model.TableSchema getSchema()
      Build the output table schema.
      • Methods inherited from class org.apache.beam.sdk.transforms.PTransform

        addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, populateDisplayData, setDisplayData, setResourceHints, toString, validate, validate
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • projectId

        protected java.lang.String projectId
      • datasetId

        protected java.lang.String datasetId
      • tableName

        protected java.lang.String tableName
    • Constructor Detail

      • WriteToBigQuery

        public WriteToBigQuery()
      • WriteToBigQuery

        public WriteToBigQuery​(java.lang.String projectId,
                               java.lang.String datasetId,
                               java.lang.String tableName,
                               java.util.Map<java.lang.String,​WriteToBigQuery.FieldInfo<InputT>> fieldInfo)
    • Method Detail

      • getSchema

        protected com.google.api.services.bigquery.model.TableSchema getSchema()
        Build the output table schema.
      • expand

        public org.apache.beam.sdk.values.PDone expand​(org.apache.beam.sdk.values.PCollection<InputT> teamAndScore)
        Specified by:
        expand in class org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PCollection<InputT>,​org.apache.beam.sdk.values.PDone>