Skip to content

Instantly share code, notes, and snippets.

@planetsizebrain
Created November 16, 2021 20:48
Show Gist options
  • Save planetsizebrain/e254b35c7fa9e33fbb3f73103f69b54d to your computer and use it in GitHub Desktop.
Save planetsizebrain/e254b35c7fa9e33fbb3f73103f69b54d to your computer and use it in GitHub Desktop.
package org.flywaydb.core;
import com.simba.googlebigquery.jdbc42.DataSource;
import org.flywaydb.core.Flyway;
import java.net.URISyntaxException;
import java.sql.SQLException;
public class BQTest {
public static void main(String[] args) throws SQLException, URISyntaxException {
DataSource dataSource = new DataSource();
dataSource.setURL("jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443;ProjectId=my-gcp-project-id;OAuthType=0;OAuthServiceAcctEmail=flyway@my-gcp-project-id.iam.gserviceaccount.com;OAuthPvtKeyPath=/Users/developer/.config/gcloud/my-gcp-project-id-9304a025abc6.json;");
Flyway flyway = Flyway.configure()
.createSchemas(false)
.defaultSchema("my-gcp-project-id.flyway")
.schemas("my-gcp-project-id.flyway")
.dataSource(dataSource)
.load();
flyway.repair();
flyway.migrate();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment