查詢 AWS Glue Data Catalog - Amazon Athena

查詢 AWS Glue Data Catalog

由於許多 AWS 服務 都會使用 AWS Glue Data Catalog 作為其中央中繼資料儲存庫,您可能需要查詢資料目錄中繼資料。若要執行此操作,您可以在 Athena 中使用 SQL 查詢。您可以使用 Athena 查詢 AWS Glue 目錄中繼資料,例如資料庫、資料表、分割區和資料欄。

若要取得 AWS Glue 目錄中繼資料,請在 Athena 後端查詢 information_schema 資料庫。本主題中的查詢範例會顯示如何使用 Athena 來查詢常見使用案例的 AWS Glue 目錄中繼資料。

考量與限制

  • 不是查詢 information_schema 資料庫,可使用個別 Apache Hive DDL 命令,擷取特定資料庫、資料表、檢視、分割區和資料欄的中繼資料資訊。然而,輸出採用非表格格式。

  • 如果您擁有小到中等數量的 AWS Glue 中繼資料,則查詢 information_schema 具有最高效能。如果您有大量中繼資料,則可能會出現錯誤。

  • 您無法使用 CREATE VIEWinformation_schema 資料庫上建立檢視。