Search code examples
cassandracassandra-3.0cqlshscylla

cassandra how to select token for compound primary key


I want to get the token for a row of my table whose primary key looks like this:

PRIMARY KEY ((C1, C2), C3)

I tried selecting with the following

SELECT token((C1, C2), C3) from myTable

but get an error SyntaxException: line 1:12 no viable alternative at input '('

what is the proper syntax for this type of query


Solution

  • Token could be called only on the partition key part of the primary key. In your case it will be

    select token(C1, C2) from myTable;