Class SpannerSource
Source<Singer, ?, ?> source =
SpannerSource.<Singer>builder()
.database(DatabaseDestination.of("my-project", "my-instance", "my-db"))
.readOperation(
SpannerReadOperation.query(
Statement.of("SELECT id, name FROM singers")))
.deserializer(mySingerDeserializer)
.build();
The read is bounded: the source reads the rows the operation names, at one snapshot, and finishes. That is not the same as batch-only — a bounded source runs inside a streaming pipeline and simply ends, which is what makes reading a Spanner table and joining it against an unbounded stream work.
Every subtask reads the same snapshot. The source asks Spanner to divide the read into partitions at one timestamp, and each subtask rejoins that transaction to read the partitions it was given. There is no column to split on and no bounds to supply: where the divisions fall is the service's decision, made from how the data is actually stored.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> SpannerSourceBuilder<T>builder()Returns a builder for a Spanner batch source.
-
Method Details
-
builder
Returns a builder for a Spanner batch source.The source returned by the builder implements
LineageVertexProvider. Explicit table and index reads identify the base table in namespacespanner://project:instance, with namedatabase.table; a native API name already containing its schema retains that qualification. Arbitrary SQL has an empty dataset list. Extraction uses configuration only and never evaluates a read resolver or deserializer, loads credentials, or opens a client. Flink 2.x extracts this metadata automatically; Flink 1.20 supports direct inspection but not native listener delivery.- Type Parameters:
T- the record type produced- Returns:
- the builder
-