Skip to content

[Feature Request]: Datastream to Spanner Dataflow template to support Spanner datastream type #4074

Open

Description

@szymon-durak-flyr

Related Template(s)

Primary: Datastream to Cloud Spanner template
Secondary: Spanner to SourceDB template, SourceDB to Spanner template

What feature(s) are you requesting?

Currently, you can build a Datastream to stream Spanner CDC into GCS bucket: https://docs.cloud.google.com/datastream/docs/sources-spanner
There also exist a complementary Dataflow template to consume Datastream from GCS and stream to Spanner: https://github.com/GoogleCloudPlatform/DataflowTemplates/blob/main/v2/datastream-to-spanner/README_Cloud_Datastream_to_Spanner.md

Unfortunately, the two are not compatible with each other since the Dataflow template does not allow Spanner as a Datastream source type, and other types are not compatible with Spanner: https://github.com/GoogleCloudPlatform/DataflowTemplates/blob/main/v2/datastream-to-spanner/src/main/java/com/google/cloud/teleport/v2/templates/source/DatastreamToSpannerSourceConnectorRegistry.java#L35-L50

The request is to add support for Spanner within the template by implementing a complementary connector, so that it is possible to build Spanner-Spanner live migrations as per: https://docs.cloud.google.com/spanner/docs/data-migration#live-data-migration

Alternatively, if this route is not planned to be supported, or if there is another, supported way to perform live migrations between Spanner databases, the request is to cover that route in documentation and tooling. So far, I have reviewed multiple possible routes and some seem possible but not covered, so it is not clear whether they are supported at all.

Workarounds

Performing "Spanner instance move" is not the same use case. It moves entire Spanner instances as-is, which is not suitable for cases like re-architecting the Spanner instances, which is what we currently do. As such, we need a way to perform a live migration of one Spanner DB at a time, between 2 arbitrary Spanner instances.

The workaround I found and tried is that you can stream your CDC directly between Spanner instances using Spanner to SourceDB streaming template, however this seems to lack official support and is not documented, so I have low confidence in this solution: https://github.com/GoogleCloudPlatform/DataflowTemplates/blob/main/v2/spanner-to-sourcedb/README.md / https://github.com/GoogleCloudPlatform/DataflowTemplates/blob/main/v2/spanner-to-sourcedb/src/main/java/com/google/cloud/teleport/v2/templates/SpannerToSourceDb.java#L410

Yet another workaround, which I haven't tried, is to try the other template (Source DB to Spanner), which seems to accept just about any JDBC driver and connection string, so in theory you can provide Spanner JDBC driver. However, it lacks documentation on which drivers are available OOTB and which needs to be supplied by the user: https://github.com/GoogleCloudPlatform/DataflowTemplates/blob/main/v2/sourcedb-to-spanner/README.md#optional-parameters

Thank you!

Activity

  1. chamikaramj commented on Aug 17, 2026

    @chamikaramj
    Contributor

    @GoogleCloudPlatform/spanner-migrations-team can someone pls take a look at this issue pls.

  2. bharadwaj-aditya commented on Aug 18, 2026

    @bharadwaj-aditya
    Contributor

    Using the Spanner-to-sourcedb is a viable option here with some changes to accommodate Spanner as a target. There have been a few contributions towards this feature. We can take this up as a feature request to close this gap, but i can't comment on a timeline as of now.

  3. szymon-durak-flyr commented on Sep 2, 2026

    @szymon-durak-flyr
    Author

    So as I understand, for now we should use Spanner-to-sourcedb / Sourcedb-to-spanner as a working solution, even if it's not officially covered as a supported migration path.

    A more complete feature to support Spanner-to-Spanner migrations would be beneficial to our use case, as we need to reorganize our Spanner topology/architecture without having to resort to multiple hours of downtime.

  4. szymon-durak-flyr commented on Sep 30, 2026

    @szymon-durak-flyr
    Author

    Hi, I would like to follow up on this. Has it been accepted as a feature request?

  5. manitgupta commented on Sep 30, 2026

    @manitgupta
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    additionNew feature or requestp2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions