檢視表格的標籤 - Amazon Keyspaces (適用於 Apache Cassandra)

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

檢視表格的標籤

下面的例子演示了如何使用控制台 Amazon Keyspaces 表的標籤CQL,或 AWS CLI.

Console
使用主控台檢視表格的標籤
  1. 登入 AWS Management Console,然後在https://console.aws.amazon.com/keyspaces/家中打開 Amazon Keyspaces 控制台。

  2. 在導覽窗格中,選擇 Tables (資料表)。

  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
使用檢視表格的標籤 AWS CLI
  • 此範例顯示如何列出指定資源的標籤。

    aws keyspaces list-tags-for-resource --resource-arn 'arn:aws:cassandra: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" } ] }