Membuat namespace dalam katalog (seperti katalog REST Apache Iceberg atau katalog Apache Hive) membantu Anda mengatur tabel dalam katalog runtime Lakehouse.
Sebelum memulai
- Baca Tentang katalog runtime Lakehouse untuk memahami cara kerja katalog runtime Lakehouse dan batasan untuk layanan ini.
- 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 theresourcemanager.projects.createpermission. Learn how to grant roles. - 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 theresourcemanager.projects.createpermission. Learn how to grant roles.
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
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 Service Usage Admin IAM
role (roles/serviceusage.serviceUsageAdmin), which
contains the serviceusage.services.enable permission. Learn how to grant
roles.
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
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 Service Usage Admin IAM
role (roles/serviceusage.serviceUsageAdmin), which
contains the serviceusage.services.enable permission. Learn how to grant
roles.
Peran yang diperlukan
Untuk mendapatkan izin yang Anda perlukan untuk membuat namespace, minta administrator Anda untuk memberi Anda peran IAM berikut di project Anda:
-
Semua:
- Admin BigLake (
roles/biglake.admin) - Storage Admin (
roles/storage.admin)
- Admin BigLake (
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.
Membuat namespace
Buat namespace dalam katalog.
Pertimbangan
Saat membuat namespace, Anda dapat secara opsional menentukan bucket Cloud Storage atau jalur untuk dikaitkan dengan namespace:
- Multi-bucket (
bl://) (direkomendasikan): Anda dapat menetapkan lokasi kustom apa pun selama berada di bawah lokasi yang diizinkan oleh katalog (default_locationataurestricted_locations). Jika Anda tidak menentukan lokasi, namespace akan dibuat di bawah lokasi default katalog (misalnya,gs://{default_location}/{namespace_name}). Single-bucket (
gs://): Lokasi namespace otomatis diwarisi dari bucket tunggal katalog.
Konsol
Dikonsol, buka halaman Lakehouse. Google Cloud
Pilih katalog yang ada atau buat katalog jika Anda belum memilikinya.
Di menu bar, klik + Create namespace.
Untuk Namespace name, masukkan nama unik untuk namespace Anda.
Untuk Location, tentukan secara opsional bucket Cloud Storage atau jalur untuk dikaitkan dengan namespace Anda. Lokasi ini cocok dengan bucket data warehouse.
Klik Create.
Namespace Anda akan dibuat dan muncul dalam daftar detail katalog Anda.
gcloud
Membuat namespace dalam katalog multi-bucket (bl://) (direkomendasikan)
Untuk membuat namespace dalam katalog multi-bucket (tempat Anda dapat secara opsional menentukan lokasi kustom), jalankan perintah gcloud biglake iceberg namespaces create command dengan tanda --properties flag:
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: Project ID Google Cloud Anda.CATALOG_ID: ID katalog Anda.LOCATION: (Opsional) bucket Cloud Storage atau jalur kustom untuk dikaitkan dengan namespace (misalnya,gs://my-bucket/my-path).
Membuat namespace dalam katalog single-bucket (gs://)
Untuk membuat namespace dalam katalog single-bucket, hapus tanda --properties.
Lokasi namespace otomatis diwarisi dari bucket tunggal 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
CreateIcebergNamespace endpoint:
POST /iceberg/v1/restcatalog/v1/projects/PROJECT_ID/catalogs/CATALOG_ID/namespaces
Isi permintaan harus berisi payload JSON CreateNamespaceRequest Iceberg yang valid yang menentukan properti dan ID namespace:
{
"namespace": [
"NAMESPACE_NAME"
],
"properties": {
"location": "LOCATION"
}
}
Ganti kode berikut:
PROJECT_ID: Project ID Google Cloud Anda.CATALOG_ID: ID katalog Anda.NAMESPACE_NAME: nama untuk namespace Anda.LOCATION: (Opsional) bucket Cloud Storage atau jalur kustom untuk dikaitkan dengan namespace (misalnya,gs://my-bucket/my-path).