Created
November 16, 2021 20:48
-
-
Save planetsizebrain/e254b35c7fa9e33fbb3f73103f69b54d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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