Reputation: 279890
I'm trying to insert some rows into a Cassandra (1.2.16) database with CQL, but the Datastax API call is being rejected. The query is created through a PreparedStatement
and executed with a BoundStatement
like so
session.Execute (boundStatement);
// query is
INSERT INTO "KeyspaceName.ColumnFamilyName" (key, column1, value) VALUES (?, ?, ?)
It gets rejected with
Caught an exception Cassandra.InvalidQueryException: unconfigured columnfamily KeyspaceName.ColumnFamilyName
// which happens at the Execute call above
However, I can see that the column family does exist
var cluster = Cluster.Builder ()
.AddContactPoint ("127.0.0.1")
.Build ();
new List<string> (cluster.Metadata.GetKeyspaces ()).ForEach ((value) => {
Console.WriteLine ("Keyspace: " + value);
new List<string> (cluster.Metadata.GetKeyspace(value).GetTablesNames()).ForEach((tableName) => {
Console.WriteLine("Table: " + tableName);
});
});
which prints (among others)
Keyspace: KeyspaceName
Table: ColumnFamilyName
So the column family is there.
Why can't Cassandra find the table/column family when executing the CQL INSERT
query? Is this a version issue? I'm under the impression that newer versions of CQL refer to column families as tables. How should I configure the table?
Upvotes: 0
Views: 15550
Reputation: 14153
The exception basically means you haven't created that column family. You can retrieve it however the exception is telling you its looking for a cf named KeyspaceName.ColumnFamilyName
. You have to have "KeyspaceName" and "ColumnFamilyName" in separate quotation marks, otherwise the parser will think you are only supplying a name for a column family. It will see your query as, I want to insert data into a column family of name "KeyspaceName.ColumnFamilyName", so try:
INSERT INTO "KeyspaceName"."ColumnFamilyName" (key, column1, value) VALUES (?, ?, ?)
^ ^
|
This is where the magic happens!
Upvotes: 9