名前空間の作成

カタログ(Apache Iceberg REST カタログや Apache Hive カタログなど)に Namespace を作成すると、 Lakehouse ランタイム カタログ内のテーブルを整理できます。

始める前に

  1. Lakehouse ランタイム カタログについてを読んで、Lakehouse ランタイム カタログの仕組みとサービスの制限事項を理解してください。
  2. アカウントに Google Cloud ログインします。 Google Cloudを初めて使用する場合は、 アカウントを作成して、実際のシナリオで Google プロダクトのパフォーマンスを評価してください。新規のお客様には、ワークロードの実行、テスト、デプロイができる無料クレジット $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

必要なロール

Namespace の作成に必要な権限を取得するには、プロジェクトに対する次の IAM ロールを付与するよう管理者に依頼してください。

ロールの付与については、プロジェクト、フォルダ、組織へのアクセス権の管理をご覧ください。

必要な権限は、カスタム ロールや他の事前定義 ロールから取得することもできます。

Namespace の作成

カタログ内に Namespace を作成します。

考慮事項

Namespace を作成するときに、Namespace に関連付ける Cloud Storage バケットまたはパスを指定できます。

  • 複数バケット カタログ (推奨): カタログで許可されているロケーション(default_location または restricted_locations)の下にある限り、任意のカスタム ロケーションを設定できます。ロケーションを指定しない場合、Namespace はカタログのデフォルトの場所(gs://{default_location}/{namespace_name} など)に作成されます。
  • 単一バケット カタログ: Namespace のロケーションは、カタログの単一バケットから自動的に 継承されます。

コンソール

  1. Google Cloud コンソールで、[Lakehouse] ページを開きます。

    [Lakehouse] に移動

  2. 既存のカタログを選択するか、カタログがない場合は作成します。

  3. メニューバーで、[+ Namespace を作成] をクリックします。

  4. [**Namespace 名**] に、Namespace の一意の名前を入力します。

  5. [**ロケーション**] で、Namespace に関連付ける Cloud Storage バケットまたはパス を指定します。ロケーションはウェアハウス バケットと一致します。

  6. [作成] をクリックします。

    Namespace が作成され、カタログの詳細リストに表示されます。

gcloud

複数バケット カタログに Namespace を作成する(推奨)

複数バケット カタログに Namespace を作成するには (必要に応じてカスタム ロケーションを指定できます)、 gcloud biglake iceberg namespaces create コマンド--properties フラグとともに実行します。

gcloud biglake iceberg namespaces create NAMESPACE_NAME \
    --project="PROJECT_ID" \
    --catalog="CATALOG_ID" \
    [--properties="location=LOCATION"]

次のように置き換えます。

  • NAMESPACE_NAME: Namespace の名前。
  • PROJECT_ID: 実際の Google Cloud プロジェクト ID。
  • CATALOG_ID: カタログの ID。
  • LOCATION: (省略可)Namespace に関連付けるカスタム Cloud Storage バケットまたはパス(gs://my-bucket/my-path など)。

単一バケット カタログに Namespace を作成する

単一バケット カタログに Namespace を作成するには、--properties フラグを省略します。 Namespace のロケーションは、カタログの単一バケットから自動的に継承されます。

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

REST

REST API を使用して Namespace を作成するには、POST リクエストを CreateIcebergNamespace エンドポイントに送信します。

POST /iceberg/v1/restcatalog/v1/projects/PROJECT_ID/catalogs/CATALOG_ID/namespaces

リクエストの本文には、Namespace の識別子とプロパティを定義する有効な Iceberg CreateNamespaceRequest JSON ペイロードを含める必要があります。

{
  "namespace": [
    "NAMESPACE_NAME"
  ],
  "properties": {
    "location": "LOCATION"
  }
}

次のように置き換えます。

  • PROJECT_ID: 実際の Google Cloud プロジェクト ID。
  • CATALOG_ID: カタログの ID。
  • NAMESPACE_NAME: Namespace の名前。
  • LOCATION: (省略可)Namespace に関連付けるカスタム Cloud Storage バケットまたはパス(gs://my-bucket/my-path など)。

次のステップ