英文:
CREATE COLUMNFAMILY statement returns SyntaxException: "no viable alternative at input 'with'"
问题
I am learning Cassandra and CQL. I could create the keyspace. While creating the columnfamily, I am getting the error: SyntaxException: line 1:27 no viable alternative at input 'with' (create columnfamily users ([with]...)
我正在学习Cassandra和CQL。我可以创建键空间。在创建列族时,我遇到了错误:SyntaxException:第1行第27列,在输入'with'时没有可行的替代项(create columnfamily users ([with]...)
I want to know what is wrong in this command:
我想知道这个命令有什么问题:
with 'key_validation_class'='UTF8Type'
and 'comparator'='UTF8Type'
and 'default_validation_class'='UTF8Type'
);
and how to correct?
以及如何纠正?
While defining the column family, I have not defined any columns with the column family users.
在定义列族时,我没有为列族用户定义任何列。
I ran the Cassandra from Docker. I have created 3 instances and could run. I could create few keyspaces and create table command also works fine. In addition I want to try the CREATE columnfamily command also (without defining the columns).
我从Docker中运行了Cassandra。我创建了3个实例并成功运行。我可以创建一些键空间,创建表的命令也运行正常。此外,我还想尝试CREATE columnfamily命令(不定义列)。
英文:
I am learning Cassandra and CQL. I could create the keyspace. While creating the columnfamily, I am getting the error: SyntaxException: line 1:27 no viable alternative at input 'with' (create columnfamily users ([with]...)
I want to know what is wrong in this command:
create columnfamily users (
with 'key_validation_class'='UTF8Type'
and 'comparator'='UTF8Type'
and 'default_validation_class'='UTF8Type'
);
and how to correct?
While defining the column family, I have not defined any columns with the column family users.
I ran the Cassandra from Docker. I have created 3 instances and could run. I could create few keyspaces and create table command also works fine. In addition I want to try the CREATE columnfamily command also (without defining the columns).
答案1
得分: 1
The CREATE COLUMNFAMILY
syntax has not been supported for a number of years now since it belongs to the very old Cassandra storage format that is associated with the Thrift protocol.
Thrift was deprecated in Cassandra about 9 years ago, replaced by CQL in 2011 (CASSANDRA-1703). Cassandra 2.2 stopped using Thrift in 2015 (CASSANDRA-8358, CASSANDRA-9319) and Cassandra 4.0 completely removed Thrift in 2016 (CASSANDRA-11115).
Instead of "column families" in Thrift, they are now called tables in CQL and the equivalent command is CREATE TABLE
.
If you'd like to learn about Cassandra, we have free hands-on tutorials at datastax.com/dev. I highly recommend doing the Cassandra Fundamentals series so you can quickly learn the basics and you don't have to install anything since everything you need is provided within the tutorials. Cheers!
英文:
The CREATE COLUMNFAMILY
syntax has not been supported for a number of years now since it belongs to the very old Cassandra storage format that is associated with the Thrift protocol.
Thrift was deprecated in Cassandra about 9 years ago, replaced by CQL in 2011 (CASSANDRA-1703). Cassandra 2.2 stopped using Thrift in 2015 (CASSANDRA-8358, CASSANDRA-9319) and Cassandra 4.0 completely removed Thrift in 2016 (CASSANDRA-11115).
Instead of "column families" in Thrift, they are now called tables in CQL and the equivalent command is CREATE TABLE
.
If you'd like to learn about Cassandra, we have free hands-on tutorials at datastax.com/dev. I highly recommend doing the Cassandra Fundamentals series so you can quickly learn the basics and you don't have to install anything since everything you need is provided within the tutorials. Cheers!
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论