Reading from Cloud Spanner

To read from Cloud Spanner, apply SpannerIO.Read transformation. It will return a
PCollection of Structs, where each element represents
an individual row returned from the read operation. Both Query and Read APIs are supported.
See more information about reading from
Cloud Spanner

The transform does not provide same transactional guarantees as Cloud Spanner. In particular,

Mutations are not submitted atomically;

A mutation is applied at least once;

If the pipeline was unexpectedly stopped, mutations that were already applied will not get
rolled back.

Use MutationGroup to ensure that a small set mutations is bundled together. It is
guaranteed that mutations in a group are submitted in the same transaction. Build
SpannerIO.Write transform, and call SpannerIO.Write.grouped() method. It will return a
transformation that can be applied to a PCollection of MutationGroup.