Cassandra : missing EOF at ')' when trying to create simple table

11,959

Solution 1

CREATE TABLE TEST(
        timestamp timestamp,
        system_id text,
        hostname text,
        cpu_pct float,
        memory_used bigint,
        PRIMARY KEY(system_id, timestamp)
    );

See CQL CREATE TABLE Doc

Solution 2

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.

Solution 3

PRIMARY_KEY() should be PRIMARY KEY().

Share:
11,959

Related videos on Youtube

user43995
Author by

user43995

Updated on September 15, 2022

Comments

  • user43995
    user43995 over 1 year

    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)[)];)"
    
    
  • slime smile
    slime smile over 8 years
    The change here is the space instead of the underscore in 'PRIMARY KEY'