Using Liquibase with Snowflake
Snowflake enables data storage, processing, and analytic solutions and runs on the cloud infrastructure. Snowflake is a software-as-a-service (SaaS) offering:
- There is no hardware (virtual or physical) to select, install, configure, or manage.
- There is virtually no software to install, configure, or manage.
- Ongoing maintenance, management, upgrades, and tuning are handled by Snowflake.
For more information, see the Snowflake documentation page.
Supported Versions
- 5.24.0
Note: The supported versions are the versions that were tested with Liquibase Test Harness.
Prerequisites
Before using Liquibase with your database, ensure you have:
- Installed Liquibase.
- Created a Liquibase project folder to store all Liquibase files.
- Created a new Liquibase properties file or are using the existing
liquibase.properties
file included in the installation package. For more information, see Specifying Properties in a Connection Profile.
Driver Information
To use Liquibase and Snowflake, you need to have two jar files – the JDBC and the Liquibase Snowflake extension:
- Ensure you have downloaded the Snowflake JDBC driver jar file to connect to the Snowflake database. To download the Snowflake driver jar file, go to the Maven Central Repository and select the version you need.
- Place the
snowflake-jdbc-<version>.jar
file in theliquibase/lib
directory. - Open the Liquibase properties file and specify the following driver value:
- Go to the liquibase-snowflake repository and download the latest released Liquibase extension
liquibase-snowflake-<version>.jar
file. - Place the
liquibase-snowflake-<version>.jar
file in theliquibase/lib
directory.
driver: net.snowflake.client.jdbc.SnowflakeDriver
Note: If you place the snowflake-jdbc-<version>.jar
and liquibase-snowflake-<version>.jar
files in a different directory, specify the path in the Liquibase properties file, as follows: classpath:../path_to_drivers/snowflake-jdbc-<version>.jar; liquibase-snowflake-<version>.jar
. For more information, see Specifying Properties in a Connection Profile.
- Install the JCE Unlimited Strength Jurisdiction Policy Files for Oracle Java if you use Oracle Java and need to encrypt stage files using 256-bit keys. After you download the zip file, which contains a
README.txt
file and two.jar
files, put the two.jar
files in thejre/lib/security
subdirectory of your Java installation.
Note: The JDBC driver uses the AES specification to encrypt files uploaded to Snowflake stages. The JDBC driver automatically encrypts staged files using 128-bit keys. However, to use 256-bit keys instead of the default 128-bit keys for encryption of staged files, follow the Java Requirements for JDBC Driver documentation.
If you use Maven, you also need to download the Snowflake driver jar file and put the driver in a location that your Maven build can access. Configure the Maven pom.xml
file to use the local copy of the driver jar file. For example:
<dependency>
<groupId>net.snowflake</groupId>
<artifactId>snowflake-jdbc</artifactId>
<version>4.0.0</version>
</dependency>
Additionally, you need to specify the Liquibase Snowflake extension in your pom.xml
file as explained in Configuring Liquibase Attributes in your Maven POM File. Make sure that the Liquibase plugin and the extension have the same version.
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-snowflake</artifactId>
<version>4.4.0</version>
</dependency>
Testing Your Connection
For Liquibase and Snowflake to work, you need to:
- Ensure your Snowflake database is configured. To validate that Snowflake is available, you can use the SnowSQL CLI tool and run
connect
. You can also log into the Snowflake console in your browser to validate that the instance is running. The browser link is different for each Snowflake instance, but the format is the following:https://<cloudHostName>.snowflakecomputing.com
. You will receive an email with the link when the database is ready for use. - Specify the database URL in the Liquibase properties file, as follows:
url: jdbc:snowflake://<account_ID>.snowflakecomputing.com/?<connection_params>
Note: The account ID is the host name for your Snowflake instance. Snowflake sends an email with the URL to the host. The JDBC driver only needs the hostname, not the full URL: tn12345.us-east-1.snowflakecomputing.com
.
Example: Depending on the cloud provider you select during the database creation, your domain name will be different. The example is for an AWS cloud instance: jdbc:snowflake://tn12345.us-east-1.snowflakecomputing.com/?db=lbcat&schema=public
.
Tip: To apply a Liquibase Pro key to your project, add the following property to the Liquibase properties file: liquibaseProLicenseKey: <paste code here>
- Create a text file called changelog (
.xml
,.sql
,.json
, or.yaml
) in your project directory and add a changeset.

<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.9.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd
http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-4.9.xsd">
<changeSet id="1" author="Liquibase">
<createTable tableName="test_table">
<column name="test_id" type="int">
<constraints primaryKey="true"/>
</column>
<column name="test_column" type="varchar"/>
</createTable>
</changeSet>
</databaseChangeLog>

-- liquibase formatted sql
-- changeset liquibase:1
CREATE TABLE test_table (test_id INT, test_column VARCHAR, PRIMARY KEY (test_id))
Note: Formatted SQL changelogs generated by using Liquibase versions previous to 4.2 might cause issues because of the lack of space after a double dash ( -- ).
Tip: To fix those issues, add a space after the double dash. For example: -- liquibase formatted sql
instead of --liquibase formatted sql
and -- changeset myname:create-table
instead of --changeset myname:create-table

databaseChangeLog:
- changeSet:
id: 1
author: Liquibase
changes:
- createTable:
columns:
- column:
name: test_column
type: INT
constraints:
primaryKey: true
nullable: false
tableName: test_table

{
"databaseChangeLog": [
{
"changeSet": {
"id": "1",
"author": "Liquibase",
"changes": [
{
"createTable": {
"columns": [
{
"column":
{
"name": "test_column",
"type": "INT",
"constraints":
{
"primaryKey": true,
"nullable": false
}
}
}]
,
"tableName": "test_table"
}
}]
}
}]
}
- Navigate to your project folder in the CLI and run the Liquibase status command to see whether the connection is successful. You can pass arguments in the CLI or keep them in the Liquibase properties file.
- Run your first update with the update command, which makes changes to your database. You can also run the update-sql command to inspect the SQL before running the
update
command.
liquibase --username=test --password=test --changelog-file=<changelog.xml> status
liquibase --changelog-file=<changelog.xml> update-sql
liquibase --changelog-file=<changelog.xml> update
From a database UI tool, ensure that your database contains the table you added along with the DATABASECHANGELOG table and DATABASECHANGELOGLOCK table.

Change Type | Supported |
---|---|
addAutoIncrement | Supported |
addCheckConstraint | Not Supported (the object does not exist on the Snowflake database) |
addColumn | Supported |
addDefaultValue | Supported |
addForeignKeyConstraint | Supported |
addLookupTable | Supported |
addNotNullConstraint | Supported |
addPrimaryKey | Supported |
addUniqueConstraint | Supported |
alterSequence | Supported |
createFunction | Not Supported |
createIndex | Not Supported (the object does not exist on the Snowflake database) |
createPackage | Not Supported (the object does not exist on the Snowflake database) |
createPackageBody | Not Supported (the object does not exist on the Snowflake database) |
createProcedure | Supported |
createSequence | Supported |
createSynonym | Not Supported |
createTable | Supported |
createTrigger | Not Supported (the object does not exist on the Snowflake database) |
createView | Supported |
customChange | Supported |
delete | Supported |
disableCheckConstraint | Not Supported (the object does not exist on the Snowflake database) |
disableTrigger | Not Supported (the object does not exist on the Snowflake database) |
dropAllForeignKeyConstraints | Supported |
dropCheckConstraint | Not Supported (the object does not exist on the Snowflake database) |
dropColumn | Supported |
dropDefaultValue | Supported |
dropForeignKeyConstraint | Supported |
dropFunction | Not Supported |
dropIndex | Not Supported (the object does not exist on the Snowflake database) |
dropNotNullConstraint | Supported |
dropPackage | Not Supported (the object does not exist on the Snowflake database) |
dropPackageBody | Not Supported (the object does not exist on the Snowflake database) |
dropPrimaryKey | Supported |
dropProcedure | Supported |
dropSequence | Supported |
dropSynonym | Not Supported (the object does not exist on the Snowflake database) |
dropTable | Supported |
dropTrigger | Not Supported (the object does not exist on the Snowflake database) |
dropUniqueConstraint | Supported |
dropView | Supported |
empty | Supported |
enableCheckConstraint | Not Supported (the object does not exist on the Snowflake database) |
enableTrigger | Not Supported (the object does not exist on the Snowflake database) |
executeCommand | Supported |
insert | Supported |
loadData | Supported |
loadUpdateData | Supported |
markUnused | Not Supported (the object does not exist on the Snowflake database) |
mergeColumns | Supported |
modifyDataType | Supported |
output | Supported |
renameColumn | Supported |
renameSequence | Supported |
renameTable | Supported |
renameTrigger | Not Supported (the object does not exist on the Snowflake database) |
renameView | Supported |
setColumnRemarks | Supported |
setTableRemarks | Supported |
sql | Supported |
sqlFile | Supported |
stop | Supported |
tagDatabase | Supported |
update | Supported |
