Using Liquibase with Cassandra

Apache Cassandra is an open source, distributed, NoSQL database. It presents a partitioned wide column storage model with consistent semantics.

Note: For more information, see the Apache Cassandra page.

Supported Versions

  • 3.11


Before using Liquibase and Cassandra, ensure you have completed the following:

Driver Information

To use Liquibase and Apache Cassandra, you need to have two jar files – JDBC and the Liquibase Cassandra extension:

  1. Ensure you have downloaded the Simba JDBC jar driver file. To download it, go to the DataStax ODBC/JDBC Drivers page and select Simba JDBC Driver for Apache Cassandra from the dropdown menu. Also, select the default package option unless you need a specific package. The driver downloads as a .zip file named
  2. Extract the CassandraJDBCxx.jar file and place it in the liquibase/lib directory.
  3. Go to the liquibase-cassandra repository and download the latest released Liquibase extension .jar file.
  4. Place the liquibase-cassandra-version.jar file in the liquibase/lib install directory.
  5. Open your file and specify the driver as follows:
  6. driver: com.simba.cassandra.jdbc42.Driver

    Note: If you put the CassandraJDBCxx.jar and liquibase-cassandra-version.jar files in any other directory, specify the path to them in the file: classpath:../path_to_drivers/CassandraJDBCxx.jar; liquibase-cassandra-version.jar.

If you use Maven, you also need to download the Simba JDBC driver for Cassandra 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:


You need to specify that the scope is system and provide the systemPath in pom.xml. In the example, the ${basedir}/lib is the location of the driver jar file.

Testing Your Connection

For Liquibase and Apache Cassandra to work, you need to:

  1. Ensure your Cassandra database is configured. If you have Cassandra tools locally and want to check the status of Cassandra, run $ bin/nodetool status. The status column in the output should report UN which stands for “Up/Normal”:
  2. # nodetool status
    Datacenter: datacenter1
    |/ State=Normal/Leaving/Joining/Moving
    -- Address Load Tokens Owns (effective) Host ID Rack
    UN 198.61 KiB 276 100.0% 5rtc74d1-237f-87c0-88eb-72643bd0a8t7 rack1

    Note: For more information, see the Installing Cassandra documentation.

  1. Specify the database URL in your file as follows:
  2. url: jdbc:cassandra://localhost:9042/myKeyspace;DefaultKeyspace=myKeyspace

    Tip: If you already have a Liquibase Pro key and want to apply it to your project, add the following property to your file: liquibaseProLicenseKey: <paste license key>.

  3. Create a text file called changelog (.xml, .sql, .json, or .yaml) in your project directory and add a changeset.
  1. Run the status command to see whether the connection is successful. Specify the name of the changelog you created in place of changelog.xml. Also, to run Liquibase commands, you need to specify your username and password in the file or on the command line. However, the username and password attributes are not required for connections and systems which use alternate means of authentication.
  2. liquibase --username=test --password=test --changeLogFile=changelog.xml status

    Note: Alternatively, you can add the changeLogFile attribute to your file.

  1. Run your first update with the Liquibaseupdate command, which will make changes to your database. You can also run the updateSQL command if you want to inspect the SQL before running the update command.
  2. liquibase --changeLogFile=changelog.xml updateSQL
    liquibase --changeLogFile=changelog.xml update

After your first update, you will see a new table along with the DATABASECHANGELOG and DATABASECHANGELOGLOCK tables added to a keyspace:

  • DATABASECHANGELOG table. This table keeps a record of all the changesets that were deployed. When you deploy, the changesets in the changelog are compared with the DATABASECHANGELOG tracking table, and only the new changesets that were not found in the DATABASECHANGELOG will be deployed.
  • DATABASECHANGELOGLOCK table. This table is used internally by Liquibase to manage access to the DATABASECHANGELOG table during deployment and ensure only one instance of Liquibase is updating the database at a time, whether that is creating, updating or deleting changes.

Supported Commands and Change Types

The supported Change Types for Cassandra are:

  • createTable
  • addColumn
  • dropColumn
  • dropTable
  • renameColumn

You can use all the commands with Liquibase and Cassandra, except for:

  • diff
  • diff JSON
  • diffChangeLog
  • generateChangeLog
  • snapshot

Related Links