刪除命名空間

刪除目錄命名空間 (例如 Apache Iceberg REST 目錄或 Apache Hive 目錄) 時,系統會從 Lakehouse 執行階段目錄取消註冊該命名空間。

雖然這會從 Lakehouse for Apache Iceberg 移除命名空間,但不會自動刪除基礎 Cloud Storage bucket 或儲存的資料檔案。

如果命名空間不含任何資料表,即可刪除。

事前準備

  1. 請參閱「關於 Lakehouse 執行階段目錄」,瞭解 Lakehouse 執行階段目錄的運作方式和服務限制。
  2. 登入 Google Cloud 帳戶。如果您是 Google Cloud新手,歡迎 建立帳戶,親自評估產品在實際工作環境中的成效。新客戶還能獲得價值 $300 美元的免費抵免額,可用於執行、測試及部署工作負載。

    In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

    Verify that billing is enabled for your Google Cloud project.

    Enable the BigLake API.

    Roles required to enable APIs

    To enable APIs, you need the serviceusage.services.enable permission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.

    Enable the API

    In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

    Verify that billing is enabled for your Google Cloud project.

    Enable the BigLake API.

    Roles required to enable APIs

    To enable APIs, you need the serviceusage.services.enable permission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.

    Enable the API

必要的角色

如要取得刪除命名空間所需的權限,請要求管理員在專案中授予您下列 IAM 角色:

如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和組織的存取權」。

您或許也能透過自訂角色或其他預先定義的角色,取得必要權限。

刪除命名空間

從目錄中刪除命名空間。

控制台

  1. 前往 Google Cloud 控制台的「Lakehouse」Lakehouse頁面。

    前往 Lakehouse

  2. 選取要刪除命名空間的目錄。

  3. 在要刪除的命名空間資料列中,依序點按 「更多命名空間動作」>「刪除」

  4. 在刪除對話方塊中輸入 DELETE,然後按一下「刪除」

gcloud

如要使用 gcloud 刪除命名空間,請執行 gcloud biglake iceberg namespaces delete 指令

gcloud biglake iceberg namespaces delete NAMESPACE_NAME \
    --project="PROJECT_ID" \
    --catalog="CATALOG_ID"

更改下列內容:

  • NAMESPACE_NAME:命名空間名稱。
  • PROJECT_ID:您的 Google Cloud 專案 ID。
  • CATALOG_ID:目錄 ID。

REST

如要使用 REST API 刪除命名空間,請對 DeleteIcebergNamespace 端點發出 DELETE 要求:

DELETE /iceberg/v1/restcatalog/v1/projects/PROJECT_ID/catalogs/CATALOG_ID/namespaces/NAMESPACE_NAME

更改下列內容:

  • PROJECT_ID:您的 Google Cloud 專案 ID。
  • CATALOG_ID:目錄 ID。
  • NAMESPACE_NAME:目錄命名空間的名稱。