本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
您可以使用 Athena 查詢從 S3 Glacier Flexible Retrieval (舊稱 Glacier) 和 S3 Glacier Deep Archive Amazon S3 儲存類別中還原的物件。您必須基於每個資料表啟用此功能。如果您在執行查詢之前未在資料表上啟用此功能,Athena 會在查詢執行期略過資料表的所有 S3 Glacier Flexible Retrieval 和 S3 Glacier Deep Archive 物件。
考量事項與限制
-
只有 Athena 引擎版本 3 才支援查詢還原的 Amazon S3 Glacier 物件。
-
此功能僅支援 Apache Hive 資料表。
-
在查詢資料之前,您必須先還原物件;Athena 不會為您還原物件。
設定資料表以使用還原的物件
若要將 Athena 資料表設定為在查詢中包含還原的物件,您必須將其 read_restored_glacier_objects
資料表屬性設定為 true
。若要這樣做,您可以使用 Athena 查詢編輯器或 AWS Glue 主控台。您也可以使用 AWS Glue CLI
使用 Athena 查詢編輯器
在 Athena 中,您可以使用 ALTER TABLE SET TBLPROPERTIES 命令來設定資料表屬性,如下列範例所示。
ALTER TABLE table_name SET TBLPROPERTIES ('read_restored_glacier_objects' = 'true')
使用 AWS Glue 主控台
在 AWS Glue 主控台中,執行下列步驟來新增read_restored_glacier_objects
資料表屬性。
在 AWS Glue 主控台中設定資料表屬性
登入 AWS Management Console ,並在 https://https://console.aws.amazon.com/glue/
開啟 AWS Glue 主控台。 -
執行以下任意一項:
-
選擇移至資料目錄。
-
在導覽窗格中,選擇資料目錄資料表。
-
-
在資料表頁面的資料表清單中,選擇您要編輯之資料表的連結。
-
選擇 Actions (動作)、Edit table (編輯資料表)。
-
在編輯資料表頁面的資料表屬性區段中,新增下列鍵值對。
-
對於 Key (索引鍵),新增
read_restored_glacier_objects
。 -
針對數值,輸入
true
。
-
-
選擇 Save (儲存)。
使用 AWS CLI
在 中 AWS CLI,您可以使用 AWS Glue update-table--table-input
引數來重新定義資料表,並在 中新增 read_restored_glacier_objects
屬性。在 --table-input
引數中,使用 Parameters
結構來指定 read_restored_glacier_objects
屬性和 true
的值。請注意,--table-input
的引數不得有空格,且必須使用反斜線來逸出雙引號。在以下範例中,使用您資料庫和資料表的名稱取代 my_database
和 my_table
。
aws glue update-table \ --database-name
my_database
\ --table-input={\"Name\":\"my_table
\",\"Parameters\":{\"read_restored_glacier_objects\":\"true\"}}
重要
AWS Glue update-table
命令可在覆寫模式中運作,這表示它會以 table-input
參數指定的新定義取代現有的資料表定義。因此,當您新增 read_restored_glacier_objects
屬性時,請務必也在 table-input
參數中指定您想要在資料表中的所有欄位。