如何使用CQL在Cassandra中切换Keyspace?

7

我使用USE billKeyspace;进入一个键空间并开始使用它。现在我想退出这个键空间并进入另一个键空间。如何做到这一点?

如果我使用exit;quit;,它会退出cql会话本身,然后我必须重新连接。


3
使用其他键空间。 - Chris Lohfink
你说得对,那确实有效。我之前尝试的时候没有使用区分大小写的 keyspace 名称,所以失败了。 - Pankaj
4个回答

16
为了切换keyspace,我没有找到其他方法,只能使用USE otherKeySpace;

9
您可以通过“use”命令轻松切换。
cqlsh>    DESC KEYSPACEs;

system_distributed system_auth system system_traces

cqlsh> use system_distributed;
cqlsh:system_distributed>
cqlsh:system_distributed>
cqlsh:system_distributed> use system_auth;
cqlsh:system_auth>

0

你应该在键空间名称周围使用引号,特别是如果它包含除字母以外的其他符号。

use "test-space";

0

您可以不使用USE命令来完成,像这样:

 select * from KeySpace1.tbl ;
 select * from KeySpace2.tbl ;

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接