Class BigQuerySink

java.lang.Object
io.github.flink.gcp.connector.bigquery.sink.BigQuerySink

@Public public final class BigQuerySink extends Object
Entry point for building a BigQuery sink.

The sink exposes a single builder-based API and dispatches, at job-graph construction time, to one of several write-method implementations, in the spirit of Apache Beam's BigQueryIO:

Those semantics assume the default FailureHandler.failJob() policy. Under a dropping policy configured through BigQuerySinkBuilder.failureHandler(FailureHandler), they cover every record except those handed to that handler, which are never written at all. A record the serializer skips by returning null is written nowhere either, under any policy.

Write methods that are not implemented yet are rejected by BigQuerySinkBuilder.build() with an UnsupportedOperationException.

Example:


 Sink<MyEvent> sink =
         BigQuerySink.<MyEvent>builder()
                 .writeMethod(WriteMethod.STORAGE_API_AT_LEAST_ONCE)
                 .destinationResolver(
                         (e, ctx) ->
                                 TableDestination.of(
                                         "my-project", "my_dataset", e.tableName()))
                 .serializer(new MyEventProtoSerializer())
                 .build();
 
  • Method Details