Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Liquibase cassandra fails #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dinchand opened this issue Nov 1, 2023 · 4 comments
Closed

Liquibase cassandra fails #36

dinchand opened this issue Nov 1, 2023 · 4 comments

Comments

@dinchand
Copy link

dinchand commented Nov 1, 2023

@maximevw Firstly Thanks for the release 4.10.2 which fixed my previous issue.

However I now encounter a new one . When I run it I now get

Unexpected error running Liquibase: line 1:53 no viable alternative at input '(' (... TABLE contacting.DATABASECHANGELOG (ID [VARCHAR](...) [Failed SQL: (0) CREATE TABLE contacting.DATABASECHANGELOG (ID VARCHAR(255) NOT NULL, AUTHOR VARCHAR(255) NOT NULL, FILENAME VARCHAR(255) NOT NULL, DATEEXECUTED datetime NOT NULL, ORDEREXECUTED INT NOT NULL, EXECTYPE VARCHAR(10) NOT NULL, MD5SUM VARCHAR(35), DESCRIPTION VARCHAR(255), COMMENTS VARCHAR(255), TAG VARCHAR(255), LIQUIBASE VARCHAR(20), CONTEXTS VARCHAR(255), LABELS VARCHAR(255), DEPLOYMENT_ID VARCHAR(10))]

I did read about the compliance mode and #25 . I am not sure if all liquibase users should use that compliance mode. I tried with that as well but no luck. Any pointers ?

@maximevw
Copy link
Collaborator

maximevw commented Nov 1, 2023

@dinchand, good news for the fix 😄

Liquibase compliance mode is strongly recommended to avoid some unexpected behaviours happening in some scenarios (for example, creating a table and populating it immediately after will fail without the Liquibase compliance mode).

Also, it seems you're trying to run classic Liquibase for SQL here because the query is not valid CQL (varchar(N) does not exist in CQL, explaining the parsing error). Are you using Liquibase Cassandra? Because, as you can see here in the Liquibase Cassandra code, the syntax of the query creating the table DATABASECHANGELOG is different.

An example of integration in a Spring application is available here: liquibase/liquibase-cassandra#212 (comment). Also, I already successfully ran the standard example provided in the Liquibase documentation as you could see in the issue #25.

I hope a new version of Liquibase Cassandra will be released soon with this JDBC wrapper (since changes have been merged in their main branch few weeks ago: liquibase/liquibase-cassandra#205)

@dinchand
Copy link
Author

dinchand commented Nov 1, 2023

@maximevw Again thanks for the clear explanations and pointers. I was indeed missing the Liquibase Cassandra as dependency.

Also after you suggested I tried using the latest Liquibase Cassandra. And now I hit

[2023-11-01 17:02:30] SEVERE [liquibase.ext] Could not get keyspace from connection
java.lang.ClassCastException: com.datical.liquibase.ext.database.jvm.ProJdbcConnection cannot be cast to com.ing.data.cassandra.jdbc.CassandraConnection
        at liquibase.ext.cassandra.database.CassandraDatabase.getKeyspace(CassandraDatabase.java:114)
        at liquibase.ext.cassandra.database.CassandraDatabase.getDefaultCatalogName(CassandraDatabase.java:136)
        at liquibase.database.AbstractJdbcDatabase.getLiquibaseCatalogName(AbstractJdbcDatabase.java:710)
        at liquibase.ext.cassandra.lockservice.LockServiceCassandra.getChangeLogLockTableName(LockServiceCassandra.java:197)
        at liquibase.ext.cassandra.lockservice.LockServiceCassandra.isLocked(LockServiceCassandra.java:183)

Possibly because the the CassandraConnection is an implementation of java.sql.Connection but liquibase has its own interface.

@maximevw
Copy link
Collaborator

maximevw commented Nov 2, 2023

Hello @dinchand,

Indeed, the latest version of Liquibase Cassandra (4.24.0) still relies on Simba JDBC driver, that's certainly why you got this cast exception.

You currently have the following alternative:

  • waiting for the next release of Liquibase Cassandra, which should use this JDBC driver (I don't know when it is planned, but I guess soon as they generally release a version each month more or less)
  • if you can't wait, you will have to re-build yourself a version based on this driver (as explained in the previously mentioned references to the ˋliquibase-cassandraˋ project, there are really few changes to do that).

@maximevw
Copy link
Collaborator

maximevw commented Nov 4, 2023

As this is not an issue directly related to the JDBC wrapper for Cassandra, I'll transform into a discussion.

@ing-bank ing-bank locked and limited conversation to collaborators Nov 4, 2023
@maximevw maximevw converted this issue into discussion #37 Nov 4, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants