作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我试图从我的数据库中删除一个表/列族,但我无法做到。
我尝试了以下命令,他们的回应是:
cqlsh:testreducedb> DROP_COLUMNFAMILY largest_time_total;
Bad Request: line 1:0 no viable alternative at input 'DROP_COLUMNFAMILY'
cqlsh:testreducedb> DROP COLUMNFAMILY largest_time_total;
Bad Request: unconfigured columnfamily largest_time_total
cqlsh:testreducedb> DROP COLUMN FAMILY largest_time_total;
Bad Request: line 1:5 no viable alternative at input 'COLUMN'
cqlsh:testreducedb> DROP COLUMN FAMILY 'largest_time_total';
Bad Request: line 1:5 no viable alternative at input 'COLUMN'
cqlsh:testreducedb> DROP COLUMN FAMILY "largest_time_total";
Bad Request: line 1:5 no viable alternative at input 'COLUMN'
cqlsh:testreducedb> DROP_TABLE largest_time_total;
Bad Request: line 1:0 no viable alternative at input 'DROP_TABLE'
cqlsh:testreducedb> DROP TABLE largest_time_total;
Bad Request: unconfigured columnfamily largest_time_total
cqlsh:testreducedb> DROP TABLE 'largest_time_total';
Bad Request: line 1:11 no viable alternative at input 'largest_time_total'
cqlsh:testreducedb> DROP TABLE "largest_time_total";
Bad Request: unconfigured columnfamily largest_time_total
[cqlsh 4.1.1 | Cassandra 2.0.5 | CQL spec 3.1.1 | Thrift protocol 19.39.0]
最佳答案
我将检查您遇到的错误,以便您可以清楚地了解正在发生的事情,但首先要注意 columnfamily == table。
cqlsh:testreducedb> DROP_COLUMNFAMILY largest_time_total; Bad Request: line 1:0 no viable alternative at input 'DROP_COLUMNFAMILY'
DROP_COLUMNFAMILY
不是有效的命令。应该是
删除列家族 或
吊台 假设您已经在使用存储上述表(又名列族)的键空间(数据库)。如果您尚未为客户端指定 key 空间,则可以在 drop 语句中指定它:
DROP TABLE <keyspace>.<columnfamily>;
DROP TABLE <keyspace>.<table>;
# the below is an actual statement assuming grocerystore is the keyspace and
# shoppers is the columnfamily
DROP TABLE "grocerystore"."shoppers";
cqlsh:testreducedb> DROP COLUMNFAMILY largest_time_total; Bad Request: unconfigured columnfamily largest_time_total
USE <keyspace>
在 cqlsh 中,例如
USE grocerystore;
COLUMN
之间有一个空格太多了和
FAMILY
:)
cqlsh:testreducedb> DROP COLUMN FAMILY largest_time_total; Bad Request: line 1:5 no viable alternative at input 'COLUMN'
USE testreducedb;
DROP COLUMNFAMILY largest_time_total;
关于cassandra - 如何在 cassandra 2.0.5 中删除表或列族?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22886259/
我是一名优秀的程序员,十分优秀!