將資料庫和資料表新增至 S3 Tables 目錄 - AWS Glue

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

將資料庫和資料表新增至 S3 Tables 目錄

請確定您擁有必要的許可,以列出和建立 區域中 Data Catalog 中的目錄、資料庫和資料表。確保已在 AWS 您的帳戶和區域中啟用 S3 Tables 整合。

將資料庫新增至 S3 Tables 目錄

新增資料庫 (主控台)

  1. 在 https://https://console.aws.amazon.com/glue/home 開啟 AWS Glue 主控台。

  2. 在左側的導覽窗格中,選擇資料庫

  3. 選擇新增資料庫

  4. 在 S3 Tables 聯合目錄中選擇 Glue 資料庫

  5. 輸入資料庫的唯一名稱。

  6. 選取映射至 S3 Tables 中資料表儲存貯體的目標目錄。

  7. 選擇 Create Database (建立資料庫)

新增資料庫 (AWS CLI)

aws glue create-database \ --region region \ --catalog-id "account-id:s3tablescatalog/my-catalog" \ --database-input '{"Name": "my-database"}'

將資料表新增至 S3 Tables 目錄

新增資料表 (主控台)

  1. 在 https://https://console.aws.amazon.com/glue/home 開啟 AWS Glue 主控台。

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

  3. 在目錄下拉式清單中選取適當的 S3 Tables 目錄。

  4. 選擇新增資料表

  5. 輸入資料表的唯一名稱。

  6. 在目錄下拉式清單中確認已選取正確的 S3 Tables 目錄。

  7. 在資料庫下拉式清單中選取資料庫。

  8. 透過輸入 JSON 或個別新增每個資料欄來輸入資料表結構描述。

  9. 選擇 Create Table (建立資料表)。

新增資料表 (AWS CLI)

aws glue create-table \ --region region \ --catalog-id "account-id:s3tablescatalog/my-catalog" \ --database-name "my-database" \ --table-input '{ "Name": "my-table", "Parameters": { "classification": "", "format": "ICEBERG" }, "StorageDescriptor": { "Columns": [ {"Name": "id", "Type": "int", "Parameters": {}}, {"Name": "val", "Type": "string", "Parameters": {}} ] } }'