Using Liquibase with BigQuery

Google BigQuery is a fully managed analytics data warehouse. For more information, see BigQuery Documentation.

Supported versions

  • 2.13.6


Install drivers

To use Liquibase and BigQuery, you need two JAR files:

Place your JAR file(s) in the liquibase/lib directory. Read more: Adding and Updating Liquibase Drivers.

If you use Maven, you must include the driver JAR as a dependency in your pom.xml file. Read more: Configuring Liquibase Attributes in your Maven POM File.


Test your connection

  1. Ensure your BigQuery database is configured. See BigQuery Quickstarts for more information. For example, you can run a query of a sample table in BigQuery using the bq command-line tool:
  2. bq show bigquery-public-data:samples.shakespeare
  3. Specify the database URL in the Liquibase properties file. Liquibase does not parse the URL. You can either specify the full database connection string or specify the URL using your database's standard JDBC format:

  4. url: jdbc:bigquery://<dbname>;ProjectId=<STR>;OAuthType=<INT>;

    Specify the name of your database in place of dbname. Specify the ID of your BigQuery project as the value of ProjectId. Specify your BigQuery authentication method as the value of OAuthType:

    OAuthType Description Notes Example
    0 Google Services Account

    You must also specify the options OAuthServiceAcctEmail and OAuthPvtKeyPath in your url property. For more information, see:

    1 Google User Account

    Requires your user account credentials. For more information, see:

    2 Google Authorization Server Access Token

    You must also specify the options OAuthAccessToken, OAuthRefreshToken, OAuthClientId, and OAuthClientSecret in your url property. For more information, see:

    3 Application Default Credentials

    For more information, see:


    For more information, see Simba JDBC Authentication Driver Configuration Options.

    Tip: To apply a Liquibase Pro key to your project, add the following property to the Liquibase properties file: licenseKey: <paste code here>

  1. Create a text file called changelog (.xml, .sql, .json, or .yaml) in your project directory and add a changeset.
  2. Navigate to your project folder in the CLI and run the Liquibase status command to see whether the connection is successful:
  3. liquibase status --username=test --password=test --changelog-file=<changelog.xml>

    Note: You can pass arguments in the CLI or keep them in the Liquibase properties file.

  4. Inspect the SQL with the update-sql command. Then make changes to your database with the update command.
  5. liquibase update-sql --changelog-file=<changelog.xml>
    liquibase update --changelog-file=<changelog.xml>
  6. From a database UI tool, ensure that your database contains the test_table you added along with the DATABASECHANGELOG table and DATABASECHANGELOGLOCK table.

Related links