Reputation: 3625
I'm trying to create a simple table in cassandra, this is the command I run,
create table app_instance(app_id int, app_name varchar, proc_id varchar, os_priority int, cpu_time int, num_io_ops int, primary_key (host_id, proc_id)) with clustering order by (proc_id DESC) ;
I get the following error,
SyntaxException: line 1:132 no viable alternative at input '(' (...int, num_io_ops int, primary_key [(]...)
What am I doing wrong here?
Upvotes: 0
Views: 51
Reputation: 13781
It should be primary key, with a space, not primary_key, as ernest_k already noted in a comment. The way you wrote it,
...cpu_time int, num_io_ops int, primary_key (host_id, proc_id)
the CQL parser thinks that "primary_key" is the name of yet another column, just as num_io_ops was, and now expects to see the name of the type - and doesn't expect an open parenthesis after the "primary_key", and this is exactly what the error message told you (albeit vaguely).
Upvotes: 1