Reputation: 597
I am trying to create a simple table on Cassandra using cqlsh. The syntax is:
CREATE TABLE TEST( timestamp timestamp, system_id text, hostname text, cpu_pct float, memory_used bigint, PRIMARY_KEY(system_id, timestamp) );
When I run this I get this error however. How to fix?
ErrorMessage code=2000 [Syntax error in CQL query] message="line 8:0 missing EOF at ')' (...,PRIMARY_KEY(system_id, timestamp)[)];)"
Upvotes: 3
Views: 13081
Reputation: 3860
CREATE TABLE TEST(
timestamp timestamp,
system_id text,
hostname text,
cpu_pct float,
memory_used bigint,
PRIMARY KEY(system_id, timestamp)
);
Upvotes: 6
Reputation: 9475
You accidentally put an underscore between "PRIMARY KEY" instead of a space.
Also you might not want a field called "timestamp" since that is also a Cassandra type, so maybe call that "ts" or something.
Upvotes: 6