sync_table fail creating index already created because a bad escape method and a column name that is a keyword in DSE but not in Cassandra

Description

When you try to make a sync_table, it fails every time, you have to delete the index already created to allow the sync_table method to create a new one.

You only need to have a column name as "node" that it isn't a reserved keyword in Cassandra but in the code it appears as DSE reserved keyword, you can see in metadata.py in cql_keywords

The method is_valid_name in metadata.py compares the column name with the DSE reserved keywords and escape the column name with "node", including the ", so lately, it doesn't match the index name trying to create it again and failing.

File "cassandra/cluster.py", line 2618, in cassandra.cluster.Session.execute
File "cassandra/cluster.py", line 4877, in cassandra.cluster.ResponseFuture.result
cassandra.InvalidRequest: Error from server: code=2200 [Invalid query] message="Index machine_by_organization_node_node_idx_1 is a duplicate of existing index machine_by_organization_node_node_idx"

The method should know if it's a column name with a non reserved keywords in Cassandra and no escape it with ".

Environment

Python 3.7
cassandra-driver==3.24.0

Pull Requests

None

Activity

Show:
Adam Holmberg
December 17, 2020, 2:58 AM

thanks for the report. Do you have a simplified bit of code you could share to reproduce?

Francisco Moreno
December 24, 2020, 4:28 AM
Edited

Here you are, sorry for the delay.

 

The error is:

File "cassandra/cluster.py", line 2618, in cassandra.cluster.Session.execute
File "cassandra/cluster.py", line 4877, in cassandra.cluster.ResponseFuture.result
cassandra.InvalidRequest: Error from server: code=2200 [Invalid query] message="Index diagram_node_idx_1 is a duplicate of existing index diagram_node_idx"

line numbers doesn’t match because I’ve inserted debug code.

Assignee

Unassigned

Reporter

Francisco Moreno

Fix versions

None

Reproduced in

3.24

PM Priority

None

External issue ID

None

Doc Impact

None

Reviewer

None

Size

None

Pull Request

None

Affects versions

Priority

Major