Search code examples
cassandracqlcql3cqlsh

CQL 3 Unable to Create Column Family With Randomized Name


When shelled into my Cassandra instance via cqlsh, I am able to create a CF using

CREATE COLUMNFAMILY IF NOT EXISTS 
  sandbox.foo
  ( created TIMESTAMP, 
    updated TIMESTAMP,  
    PRIMARY KEY (created) )  ;

but when I run

CREATE COLUMNFAMILY IF NOT EXISTS 
  sandbox.6f4922f45568161a8
  ( created TIMESTAMP, 
    updated TIMESTAMP,  
    PRIMARY KEY (created) ) ;

The command fails w/ error SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query] message="line 3:2 no viable alternative at input '(' (... IF NOT EXISTS sandbox.6f4922f45568161a8 [(]...)">.

Any idea where I'm going wrong?


Solution

  • Yes. The CREATE TABLE documentation is pretty clear on this one:

    Valid table names are strings of alphanumeric characters and underscores, which begin with a letter.

    Try placing a (random?) letter at the beginning of your table name, and then it should work.