T
- the type parameter for the HealthcareIOError
public class HealthcareIOErrorToTableRow<T> extends java.lang.Object implements org.apache.beam.sdk.transforms.SerializableFunction<HealthcareIOError<T>,com.google.api.services.bigquery.model.TableRow>
HealthcareIOError
s to BigQuery TableRow
s.
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)
);
***
Modifier and Type | Field and Description |
---|---|
static java.util.List<com.google.api.services.bigquery.model.TableFieldSchema> |
TABLE_FIELD_SCHEMAS |
static java.lang.String |
TIMESTAMP_FIELD_NAME |
Constructor and Description |
---|
HealthcareIOErrorToTableRow() |
Modifier and Type | Method and Description |
---|---|
com.google.api.services.bigquery.model.TableRow |
apply(HealthcareIOError<T> err) |
public static final java.lang.String TIMESTAMP_FIELD_NAME
public static final java.util.List<com.google.api.services.bigquery.model.TableFieldSchema> TABLE_FIELD_SCHEMAS
public com.google.api.services.bigquery.model.TableRow apply(HealthcareIOError<T> err)
apply
in interface org.apache.beam.sdk.transforms.ProcessFunction<HealthcareIOError<T>,com.google.api.services.bigquery.model.TableRow>
apply
in interface org.apache.beam.sdk.transforms.SerializableFunction<HealthcareIOError<T>,com.google.api.services.bigquery.model.TableRow>