Class HealthcareIOErrorToTableRow<T>

  • Type Parameters:
    T - the type parameter for the HealthcareIOError
    All Implemented Interfaces:
    java.io.Serializable, org.apache.beam.sdk.transforms.ProcessFunction<HealthcareIOError<T>,​com.google.api.services.bigquery.model.TableRow>, org.apache.beam.sdk.transforms.SerializableFunction<HealthcareIOError<T>,​com.google.api.services.bigquery.model.TableRow>

    public class HealthcareIOErrorToTableRow<T>
    extends java.lang.Object
    implements org.apache.beam.sdk.transforms.SerializableFunction<HealthcareIOError<T>,​com.google.api.services.bigquery.model.TableRow>
    Convenience transform to write dead-letter HealthcareIOErrors to BigQuery TableRows.

    This can be used with BigQueryIO.Write.withSchema(TableSchema) by defining a dead letter table schema

    
     ...
     PCollection<HealthcareIOError<String>> errors = ...;
    
     TableSchema deadLetterSchema = new TableSchema();
     deadLetterSchema.setFields(HealthcareIOErrorToTableRow.TABLE_FIELD_SCHEMAS);
     TimePartitioning deadLetterPartitioning = new TimeParitioning();
     deadLetterPartitioning.setField(HealthcareIOErrorToTableRow.TIMESTAMP_FIELD_NAME);
    
     errors.apply(
        BigQueryIO.write()
          .to(options.getDeadLetterTable())
          .withFormatFunction(new HealthcareIOErrorToTableRow())
          .withSchema(deadLetterSchema)
          .withTimePartitioning(deadLetterPartitioning)
     );
     ***
     
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.List<com.google.api.services.bigquery.model.TableFieldSchema> TABLE_FIELD_SCHEMAS  
      static java.lang.String TIMESTAMP_FIELD_NAME  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.google.api.services.bigquery.model.TableRow apply​(HealthcareIOError<T> err)  
      • Methods inherited from class java.lang.Object

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

      • TIMESTAMP_FIELD_NAME

        public static final java.lang.String TIMESTAMP_FIELD_NAME
        See Also:
        Constant Field Values
      • TABLE_FIELD_SCHEMAS

        public static final java.util.List<com.google.api.services.bigquery.model.TableFieldSchema> TABLE_FIELD_SCHEMAS
    • Constructor Detail

      • HealthcareIOErrorToTableRow

        public HealthcareIOErrorToTableRow()
    • Method Detail

      • apply

        public com.google.api.services.bigquery.model.TableRow apply​(HealthcareIOError<T> err)
        Specified by:
        apply in interface org.apache.beam.sdk.transforms.ProcessFunction<HealthcareIOError<T>,​com.google.api.services.bigquery.model.TableRow>
        Specified by:
        apply in interface org.apache.beam.sdk.transforms.SerializableFunction<HealthcareIOError<T>,​com.google.api.services.bigquery.model.TableRow>