gpt4 book ai didi

cassandra - 如何在 cassandra 2.0.5 中删除表或列族?

转载 作者:行者123 更新时间:2023-12-04 15:11:28 30 4
gpt4 key购买 nike

我试图从我的数据库中删除一个表/列族,但我无法做到。

我尝试了以下命令,他们的回应是:

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

有人知道如何在 Cassandra 2.0.5 中删除表/列族吗?

我在用:
[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



列族实际上并不存在。基于刚刚看到 cqlsh 我敢打赌,您没有指定使用存储 *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/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com