Amay
Amay

Reputation: 104

Unable to Create Table

I am not able to create a table. I am using Cassandra 3.10. When I create the I get the following error. Bad Request: Only clustering key columns can be defined in CLUSTERING ORDER directive. My column is a primary key even still I am facing the problem.

My schema is

Table trends{
name text,
price int,
quantity int,
code text,
uitime timeuuid,
primary key((name,code),uitime))
with clustering order by (code DESC, uitime DESC)

Upvotes: 3

Views: 351

Answers (1)

Alex Tbk
Alex Tbk

Reputation: 2104

Your composite primary key is (name, code) and your clustering key is uitime. So with the given schema you can only do:

with clustering order by (uitime DESC)

See: https://docs.datastax.com/en/cql/3.3/cql/cql_using/useCompositePartitionKeyConcept.html

Upvotes: 3

Related Questions