查看表的标签 - Amazon Keyspaces(Apache Cassandra 兼容)
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

查看表的标签

以下示例说明如何使用控制台、CQL 或在 Amazon Keyspaces 中查看表的标签。 Amazon CLI

Console
使用控制台查看表的标签
  1. 登录并在家中打开 Amazon Keyspaces 控制台。 Amazon Web Services Management Console https://console.aws.amazon.com/keyspaces/

  2. 在导航窗格中,选择

  3. 从列表中选择一个表,然后选择标签选项卡。

Cassandra Query Language (CQL)
使用 CQL 查看表的标签

要读取附加到表的标签,请使用以下 CQL 语句。

SELECT * FROM system_schema_mcs.tags WHERE valid_where_clause;

WHERE 子句必需,且必须为以下格式之一:

  • keyspace_name = 'mykeyspace' AND resource_name = 'mytable'

  • resource_id = arn

  • 以下查询将返回指定表的标签。

    SELECT * FROM system_schema_mcs.tags WHERE keyspace_name = 'mykeyspace' AND resource_name = 'mytable';

    该查询的输出如下所示。

    resource_id | keyspace_name | resource_name | resource_type | tags ----------------------------------------------------------------------------+---------------+---------------+---------------+------ arn:aws:cassandra:us-east-1:123456789:/keyspace/mykeyspace/table/mytable| mykeyspace | mytable | table | {'key1': 'val1', 'key2': 'val2'}
CLI
使用查看表格的标签 Amazon CLI
  • 本示例说明了如何列出指定资源的标签。

    aws keyspaces list-tags-for-resource --resource-arn 'arn:aws:arn:aws:cassandra:aws-region:111122223333:/keyspace/my_keyspace/table/my_table/stream/2025-05-11T21:21:33.291cassandra:us-east-1:111222333444:/keyspace/myKeyspace/table/myTable'

    最后一个命令的输出如下所示。

    { "tags": [ { "key": "key1", "value": "val1" }, { "key": "key2", "value": "val2" }, { "key": "key3", "value": "val3" }, { "key": "key4", "value": "val4" } ] }