Reputation: 339
Why is this not working:
CREATE TABLE bwlists (uuid uuid PRIMARY KEY, bwl map<ascii, bw map<ascii, ascii>>);
I got:
Bad Request: line 1:79 no viable alternative at input '>'
Upvotes: 1
Views: 1035
Reputation: 57808
CREATE TABLE bwlists (
uuid uuid PRIMARY KEY,
bwl map<ascii, bw map<ascii, ascii>>);
Bad Request: line 1:79 no viable alternative at input '>'
Your first problem, is that you are trying to name the map bw
within the bwl
map. That's not going to work, as CQL is not expecting to find an identifier (instead of a type). Your syntax can then be adjusted to this:
CREATE TABLE bwlists (
uuid uuid PRIMARY KEY,
bwl map<ascii, map<ascii, ascii>>);
But that still doesn't work. Running this CREATE
statement yields this message:
<ErrorMessage code=2000 [Syntax error in CQL query]
message="map type cannot contain another collection">
Currently, Cassandra/CQL does not permit creating a "map of a map."
Also, it's not a good idea to use reserved words as column names, even if Cassandra lets you do it. I'd rename uuid
to something more context-specific to your application.
Upvotes: 3