Reputation: 422
I am trying to update cassandra from my node script. It works if I keep the jar files provided in classpath inside the lib folder of node_module liquibase but if I keep them outside in some other folder then I get below mentioned exception. The version of liquibase I am using is 4.28.0 and Cassandra 5.0. The search path shows the classpath included but I am not able to resolve this error.
const Liquibase = require('liquibase').Liquibase;
const myConfig = {
changeLogFile: './changelog.xml',
url: 'jdbc:cassandra://localhost:9042/cycling?compliancemode=Liquibase&localDatacenter=datacenter1',
classpath: '/Users/admin/Downloads/lib/liquibase-cassandra-4.28.0.jar:/Users/admin/Downloads/lib/cassandra-jdbc-wrapper-4.13.0-bundle.jar',
driver: 'com.ing.data.cassandra.jdbc.CassandraDriver',
logLevel: 'debug',
}
const instTs = new Liquibase(myConfig);
instTs.status();
// instTs.updateSQL();
// instTs.update();
Here is my changelog.xml file
<?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"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">
<changeSet id="1" author="xyz">
<createTable tableName="test_table">
<column name="id" type="int">
<constraints primaryKey="true"/>
</column>
<column name="name" type="text"/>
</createTable>
</changeSet>
</databaseChangeLog>
But I am getting below error
liquibase.exception.DatabaseException: Error executing SQL call current_schema: The Cassandra implementation does not support this method.
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:145)
at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:227)
at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:238)
at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:246)
at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:261)
at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:256)
Upvotes: 0
Views: 59
Reputation: 11
As explained here, Liquibase only looks for extensions in 3 paths:
{liquibase_directory}/internal/lib
{liquibase_directory}/lib
{$pwd}/liquibase_libs
Is putting the liquibase-cassandra
extension and driver jars into a liquibase_libs
directory acceptable for your case?
With this structure:
.
├─ node_modules
│ └─ liquibase
│ └─ ...
├─ liquibase_libs
│ ├─ cassandra-jdbc-wrapper-4.13.0-bundle.jar
| └─ liquibase-cassandra-4.28.0.jar
├─ changelog.xml
└─ liquibase_runner.js
and with liquibase_runner.js
defined as follows:
const Liquibase = require('liquibase').Liquibase;
const myConfig = {
changeLogFile: './changelog.xml',
url: 'jdbc:cassandra://localhost:9042/cycling?compliancemode=Liquibase&localdatacenter=datacenter1',
driver: 'com.ing.data.cassandra.jdbc.CassandraDriver',
logLevel: 'debug',
}
const instTs = new Liquibase(myConfig);
instTs.status();
It should work as expected, without modifying the content of node_modules
.
Upvotes: 1