Buat namespace

Katalog runtime Lakehouse memungkinkan Anda membuat namespace di endpoint katalog Lakehouse tanpa batas untuk mengelompokkan dan mengatur tabel terkait.

Saat membuat namespace, Anda dapat secara opsional mengaitkannya dengan bucket Cloud Storage atau jalur kustom, atau mewarisi lokasi penyimpanan default katalog.

Sebelum memulai

  1. Baca Tentang katalog runtime Lakehouse untuk memahami cara kerja katalog runtime Lakehouse dan batasan untuk layanan ini.
  2. Login ke akun Google Cloud Anda. Jika Anda baru menggunakan Google Cloud, buat akun untuk mengevaluasi performa produk kami dalam skenario dunia nyata. Pelanggan baru juga mendapatkan kredit gratis senilai $300 untuk menjalankan, menguji, dan men-deploy workload.

    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, if it is not already enabled.

    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, if it is not already enabled.

    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

Peran yang diperlukan

Untuk mendapatkan izin yang Anda perlukan untuk membuat namespace, minta administrator Anda untuk memberi Anda peran IAM berikut di project Anda:

Untuk mengetahui informasi selengkapnya tentang pemberian peran, lihat Mengelola akses ke project, folder, dan organisasi.

Anda mungkin juga bisa mendapatkan izin yang diperlukan melalui peran khusus atau peran bawaan lainnya.

Buat namespace

Buat namespace dalam katalog.

Pertimbangan

Saat membuat namespace, Anda dapat secara opsional menentukan bucket Cloud Storage atau jalur untuk dikaitkan dengan namespace:

  • Katalog multi-bucket (direkomendasikan): Anda dapat menetapkan lokasi kustom mana pun selama berada di bawah lokasi yang diizinkan oleh katalog (default_location atau restricted_locations). Jika Anda tidak menentukan lokasi, namespace akan dibuat di bawah lokasi default katalog (misalnya, gs://{default_location}/{namespace_name}).
  • Katalog bucket tunggal: Lokasi namespace otomatis diwarisi dari bucket tunggal katalog.

Konsol

  1. Di konsol Google Cloud , buka halaman Lakehouse.

    Buka Lakehouse

  2. Pilih katalog yang ada atau buat katalog jika Anda belum memilikinya.

  3. Di menu bar, klik + Create namespace.

  4. Untuk Nama namespace, masukkan nama unik untuk namespace Anda.

  5. Untuk Location, opsional, tentukan bucket Cloud Storage atau jalur yang akan dikaitkan dengan namespace Anda. Lokasi cocok dengan bucket gudang.

  6. Klik Create.

    Namespace Anda dibuat dan muncul dalam daftar detail katalog.

gcloud

Membuat namespace di katalog multi-bucket (direkomendasikan)

Untuk membuat namespace di katalog multi-bucket (tempat Anda dapat secara opsional menentukan lokasi kustom), jalankan perintah gcloud biglake iceberg namespaces create dengan flag --properties:

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

Ganti kode berikut:

  • NAMESPACE_NAME: nama untuk namespace Anda.
  • PROJECT_ID: Google Cloud Project ID Anda.
  • CATALOG_ID: ID katalog Anda.
  • LOCATION: (Opsional) bucket atau jalur Cloud Storage kustom untuk dikaitkan dengan namespace (misalnya, gs://my-bucket/my-path).

Membuat namespace di katalog bucket tunggal

Untuk membuat namespace dalam katalog bucket tunggal, hilangkan tanda --properties. Lokasi namespace diwarisi secara otomatis dari satu bucket katalog.

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

REST

Untuk membuat namespace menggunakan REST API, buat permintaan POST ke endpoint CreateIcebergNamespace:

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

Isi permintaan harus berisi payload JSON CreateNamespaceRequest Iceberg yang valid yang menentukan ID dan properti namespace:

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

Ganti kode berikut:

  • PROJECT_ID: Google Cloud Project ID Anda.
  • CATALOG_ID: ID katalog Anda.
  • NAMESPACE_NAME: nama untuk namespace Anda.
  • LOCATION: (Opsional) bucket atau jalur Cloud Storage kustom untuk dikaitkan dengan namespace (misalnya, gs://my-bucket/my-path).

Langkah berikutnya