【问题标题】:How to list the available tables in different keyspaces in Amazon Keyspaces/Cassandra?如何在 Amazon Keyspaces/Cassandra 中列出不同键空间中的可用表?
【发布时间】:2021-09-16 22:15:30
【问题描述】:

我正在尝试使用 AWS Keyspace Cassandra 和 Cassandra Python 驱动程序来实现应用程序。我在我的 AWS 控制台中创建了 3 个键空间。

我正在尝试查找是否有任何查询可以一次性列出所有 3 个键空间中的所有可用表。 我尝试了以下查询,但失败了。

SELECT table_name, keyspace_name from system_schema.tables where keyspace_name IN ('mykeyspace','cycling')

AWS Keyspace 中的 CQL 编辑器是否不允许使用 IN 关键字?有人知道这样的查询或命令吗?

【问题讨论】:

  • 上面的查询对我有用,我在 cqlsh 上试过。
  • 以上查询将起作用。
  • 我也查过了。它在 Cassandra 中有效,但在 AWS Keyspaces 中尚不支持。

标签: cassandra cql amazon-keyspaces


【解决方案1】:

它确实允许我们在 Cassandra 中使用 IN 子句,甚至我也可以使用相同的查询访问表。

cassandra@cqlsh> SELECT table_name, keyspace_name from system_schema.tables where keyspace_name in ('system_traces','youkudbhelper');

表名 |键空间名称 ------------+---------------

(10 行) cassandra@cqlsh> 退出 bash-4.2$ cqlsh --version cqlsh 5.0.1 bash-4.2$

参考资料:

https://docs.datastax.com/en/cql-oss/3.3/cql/cql_using/useQueryIN.html

【讨论】:

  • 我也检查过了。它在 Cassandra 中有效,但在 AWS Keyspaces 中尚不支持。
【解决方案2】:

以下查询在 Cassandra 中工作,以列出不同键空间中的可用表。

SELECT table_name, keyspace_name from system_schema.tables where keyspace_name IN ('mykeyspace','cycling');

但 AWS Keyspaces 失败,因为 AWS Keyspaces 尚不支持 IN 关键字。

【讨论】:

    猜你喜欢
    • 2013-09-13
    • 2021-01-31
    • 2021-06-10
    • 2020-08-08
    • 2017-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多