Skip to main content

Table at a read timestamp

Create a Spanner session on the selected database using the reading principal. Mount @bijectionhq/app-rest once per table and read timestamp. Pass as receivers.provider a receiver bound to the session’s resource name with the :executeSql suffix.
Seal a Google access token with spanner.data or cloud-platform OAuth scope and access to the table. The installer owns the session and its cleanup. Bind the receiver and the mount under the same data label. Select a UTC timestamp within the database’s version-retention interval.
Use one unique, non-null INT64 key and up to fifteen projected columns. The read-only query binds the exact timestamp and the exclusive decimal key boundary on every page. Rows land as Spanner JSON, with up to 32 rows and 36 KiB per page. A short page completes the finite read. Missing keys remain. An expired session or unavailable read timestamp stops advance. Spanner ExecuteSql API

Change streams

Enable a change stream and create a reading session on its database. Mount @bijectionhq/app-documents with the data label. Follow the Google stream mount example, use spannerStream(credential, data) from that package, and pass it as provider. The receiver and the mount use the same label. Grant the principal access to query the change stream using the spanner.data or cloud-platform scope. The installer owns session creation and cleanup. Seal the following JSON in the receiver credential.
Initialize with that session, stream, and dialect, and a UTC timestamp within the stream’s retention interval. Use postgreSql for the PostgreSQL dialect.
The receiver assembles partial result values and reads one partition per pass. The app records the heartbeat watermark and inherits each child partition’s reported start time. A child becomes eligible after all its parents reach successful stream completion and publish its lineage. Independent partitions rotate through bounded turns. Each partition resumes inclusively at its last published timestamp. The app retains up to 32 event identities at that boundary until the stream advances or a heartbeat proves the timestamp covered. This lets one session read multiple partitions without sharing RPC resume tokens. The projection keys each change by a digest of the commit timestamp, transaction ID and record sequence. It stores GoogleSQL records as positional Spanner values and PostgreSQL records as provider JSON text. Deletes remain change records. A transaction spanning partitions may land in multiple commits. A pass is limited to 20 seconds, 32 events and 48 KiB of answer data within the action result’s encoded bound. The app permits up to 64 child announcements in a closing pass, 16 parents per child and 1,024 partition announcements per generation. An oversized page, expired session or rejected position holds the checkpoint. Inspect source.health and source.partitions before resetting. Use a new mount when changing the sealed session or start contract. Spanner change stream queries and lineage