Load Data with Liquibase
On this page
Liquibase provides a database schema management solution that allows you to add version control to your SingleStore databases, manage revisions of your database, and deploy scripts.
Prerequisites
Connect with Liquibase from SingleStore
To connect to your SingleStore database with Liquibase,
-
Run the following command to initialize a new Liquibase project:
liquibase init projectYou may use the default properties or customize the available parameters while initializing a new project.
In this guide, we'll use liquibase. properties as the defaults file. -
Place the downloaded SingleStore JDBC driver and Liquibase extension for SingleStore
.
files in the liquibase/lib directory.jar If you are using Maven, add the following dependencies to your pom. xml file: <dependency><groupId>com.singlestore</groupId><artifactId>singlestore-jdbc-client</artifactId><version>1.1.5</version></dependency><dependency><groupId>org.liquibase.ext</groupId><artifactId>liquibase-singlestore</artifactId><version>1.0.0</version></dependency> -
Customize the following parameters in the liquibase.
properties file: -
url: Specify the connection string for your SingleStore database in the following format:
jdbc:singlestore://<hostname>:<port>/<database>
. -
username: Specify the username of the SingleStore database user that is used to access the database.
-
password: Specify the password for the SingleStore database user.
-
driver: Specify the JDBC Driver Class as
com.
.singlestore. jdbc. Driver -
classpath: Specify the path to the downloaded SingleStore JDBC driver
.
file, including the filename and the .jar jar extension.
Here's a sample liquibase.
properties file: url:jdbc:singlestore://svchost:3306/dbTest username:s2user password:pa55w0rd liquibaseProLicenseKey: licensekey liquibase.hub.APIKey: APIKey driver:com.singlestore.jdbc.Driver classpath=~/singlestore-jdbc-client-1.1.5.jar
-
-
Update the changelog file in your project, and add a changeset.
In this guide we'll use the following changelog. sql file: -- liquibase formatted sql-- changeset admin:1CREATE TABLE Stock (ID INT, Code VARCHAR(4), PRIMARY KEY(ID)) -
Run the following command from the Liquibase installation directory:
liquibase status --changelog-file=changelog.sql-- Liquibase command 'status' was executed successfully.
For a successful connection, the output contains a similar message.
Refer to Using Liquibase with SingleStore for more information.
Last modified: September 29, 2023