CassioML / cassio

A framework-agnostic Python library to seamlessly integrate Cassandra with ML/LLM/genAI workloads
Apache License 2.0
100 stars 17 forks source link

CQL error in base_table.py line 327 #160

Open I22Scode opened 1 month ago

I22Scode commented 1 month ago

Hi I could not get a vector store created in Cassandra (running locally in docker) The keyspace exists and I have other tables in the Cassandra cluster.

The exception repored is cassandra.protocol.SyntaxException: <Error from server: code=2000 [Syntax error in CQL query] message="line 1:110 mismatched input '<' expecting ')' (..., body_blob TEXT, vector VECTOR[<]...)">

The stack trace is:

File "C:\Users\Jerome\Code\ML-studies.venv\Lib\site-packages\langchain_community\vectorstores\cassandra.py", line 121, in init self.table = MetadataVectorCassandraTable( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Jerome\Code\ML-studies.venv\Lib\site-packages\cassio\table\mixins.py", line 720, in init super().init(*pargs, new_kwargs) File "C:\Users\Jerome\Code\ML-studies.venv\Lib\site-packages\cassio\table\mixins.py", line 195, in init super().init(*pargs, *kwargs) File "C:\Users\Jerome\Code\ML-studies.venv\Lib\site-packages\cassio\table\mixins.py", line 490, in init super().init(pargs, kwargs) File "C:\Users\Jerome\Code\ML-studies.venv\Lib\site-packages\cassio\table\base_table.py", line 44, in init self.db_setup() File "C:\Users\Jerome\Code\ML-studies.venv\Lib\site-packages\cassio\table\mixins.py", line 246, in db_setup super().db_setup() File "C:\Users\Jerome\Code\ML-studies.venv\Lib\site-packages\cassio\table\mixins.py", line 498, in db_setup super().db_setup() File "C:\Users\Jerome\Code\ML-studies.venv\Lib\site-packages\cassio\table\base_table.py", line 289, in db_setup self.execute_cql(create_table_cql, op_type=CQLOpType.SCHEMA) File "C:\Users\Jerome\Code\ML-studies.venv\Lib\site-packages\cassio\table\base_table.py", line 327, in execute_cql return cast(Iterable[RowType], self.session.execute(statement, args)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The CQL statement has VECTOR<str as part of the column definition and it looks to be a wrong syntax.

Thank you

liamka commented 1 week ago

already solve this? @I22Scode

hemidactylus commented 1 week ago

Hello @I22Scode could you please check your Cassandra version? The VECTOR<float, N> syntax comes with Cassandra 5, perhaps this is the issue?

CassIO's CI runs against the "cassandra:5" Docker image, and as part of the CI integration testing statements such as the CREATE TABLE that is making your database angry are run several times.