Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Google Cloud Spanner #1880

Closed
wants to merge 26 commits into from
Closed

Conversation

olavloite
Copy link

This adds support for Google Cloud Spanner (https://cloud.google.com/spanner) to Flyway. The integration relies on the open source JDBC driver for Google Cloud Spanner (https://github.com/olavloite/spanner-jdbc) instead of the one provided by Google, as the official driver is read only.

Context

The DDL syntax and possibilities of Cloud Spanner are close to standard SQL, albeit rather limited. Further specifics:

  • Cloud Spanner does not support schemas. All databases contain a default schema named '' (emtpy string) and a system schema named INFORMATION_SCHEMA. The default schema may not be explicitly referenced, i.e. the statement CREATE TABLE ``.TEST (ID INT64 NOT NULL, ...) PRIMARY KEY (ID); will fail.
  • Cloud Spanner does not support foreign keys, but tables can be interleaved in each other. When dropping interleaved tables, the child table must be dropped before the parent table.
  • Tables can only be dropped after all secondary indices on the table have been dropped.
  • DDL statements are very slow, especially if executed sequentially. The JDBC driver therefore supports both (automatic) batching and asynchronous execution of DDL statements.

Example Application

I have created an example application showing the working of Flyway with Google Cloud Spanner. Google Cloud Spanner is only available in the Google Cloud, but you can opt for a free trial account a $300 credit for testing it.
The application can be found here: https://github.com/olavloite/spanner-flyway-example
An article describing the example can be found here: http://www.googlecloudspanner.com/2018/01/google-cloud-spanner-with-flyway.html

@CLAassistant
Copy link

CLAassistant commented Jan 1, 2018

CLA assistant check
All committers have signed the CLA.

@axelfontaine axelfontaine added this to the Flyway 5.1.0 milestone Jan 1, 2018
# Conflicts:
#	flyway-core/src/main/java/org/flywaydb/core/internal/database/DatabaseFactory.java
#	flyway-core/src/main/java/org/flywaydb/core/internal/util/jdbc/DriverDataSource.java
@axelfontaine axelfontaine removed this from the Flyway 5.2.0 milestone Sep 19, 2018
@axelfontaine axelfontaine added this to the Flyway 6.0.0 milestone Sep 19, 2018
# Conflicts:
#	flyway-core/src/main/java/org/flywaydb/core/internal/database/DatabaseFactory.java
@tuanng-cognite
Copy link

any plan to merge this?

@luiccn
Copy link

luiccn commented Jun 5, 2019

Any plans on merging this? Very interested in using this the proper way :)

@MikielAgutu MikielAgutu removed this from the Flyway 6.1.0 milestone Oct 16, 2019
@thinhha
Copy link

thinhha commented Mar 20, 2020

Ping @olavloite any plans to merge this please? :)

@DoodleBobBuffPants
Copy link
Contributor

Thanks for the PR! This is now available in the V7 beta which you can read more about here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants