Menambahkan metadata ke tabel BigQuery

Pelajari cara mulai menggunakan pengelolaan metadata di Dataplex Universal Catalog.

Panduan memulai ini menunjukkan cara menambahkan metadata ke tabel BigQuery. Dalam panduan memulai ini, Anda akan melakukan hal berikut:

  1. Buat set data dan tabel BigQuery berdasarkan set data publik.

  2. Buat template yang menentukan sekumpulan kolom metadata terkait.

    Template ini disebut jenis aspek. Kumpulan kolom metadata terkait, yang menjelaskan metadata bisnis dan teknis untuk aset data Anda, disebut aspek.

  3. Menambahkan metadata ke tabel.

    Di Dataplex Universal Catalog, setiap aset data ditampilkan sebagai entri. Untuk melampirkan metadata ke aset data, Anda menambahkan aspek ke entri.

Sebelum memulai

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. 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 (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. Enable the Dataplex and BigQuery APIs.

    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.

    Enable the APIs

  5. Make sure that you have the following role or roles on the project: Dataplex Catalog Admin, BigQuery Data Owner, BigQuery Job User

    Check for the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.

    4. For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.

    Grant the roles

    1. In the Google Cloud console, go to the IAM page.

      Buka IAM
    2. Pilih project.
    3. Klik Grant access.
    4. Di kolom New principals, masukkan ID pengguna Anda. Biasanya berupa alamat email untuk Akun Google.

    5. Di daftar Select a role, pilih peran.
    6. Untuk memberikan peran tambahan, klik Tambahkan peran lain, lalu tambahkan setiap peran tambahan.
    7. Klik Simpan.
  6. 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 (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  7. Verify that billing is enabled for your Google Cloud project.

  8. Enable the Dataplex and BigQuery APIs.

    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.

    Enable the APIs

  9. Make sure that you have the following role or roles on the project: Dataplex Catalog Admin, BigQuery Data Owner, BigQuery Job User

    Check for the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.

    4. For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.

    Grant the roles

    1. In the Google Cloud console, go to the IAM page.

      Buka IAM
    2. Pilih project.
    3. Klik Grant access.
    4. Di kolom New principals, masukkan ID pengguna Anda. Biasanya berupa alamat email untuk Akun Google.

    5. Di daftar Select a role, pilih peran.
    6. Untuk memberikan peran tambahan, klik Tambahkan peran lain, lalu tambahkan setiap peran tambahan.
    7. Klik Simpan.
  10. Membuat set data dan tabel

    1. Di konsol Google Cloud , buka halaman BigQuery Studio.

      Buka BigQuery Studio

    2. Membuat set data:

      1. Di panel Explorer, temukan project Anda. Klik View actions, lalu klik Create dataset.

      2. Di kolom Dataset ID, masukkan catalog_demo_dataset.

        Pertahankan nilai default untuk kolom lainnya.

      3. Klik Create dataset.

    3. Menyalin tabel publik ke set data Anda:

      1. Di panel Explorer, telusuri tabel bernama bigquery-public-data.new_york_citibike.citibike_stations. Anda mungkin perlu menetapkan cakupan penelusuran untuk menyertakan project bigquery-public-data.

        Tabel ini adalah bagian dari set data Perjalanan NYC Citi Bike, sebuah set data publik yang berisi data tentang program berbagi sepeda.

      2. Pilih tabel citibike_stations.

      3. Klik Copy. Masukkan informasi sebagai berikut:

        • Project: pilih project Anda.
        • Dataset: pilih catalog_demo_dataset.
        • Table: masukkan bike_stations.
      4. Klik Copy.

    4. Di panel Explorer, cari set data catalog_demo_dataset, dan pastikan tabel bike_stations tercantum dalam set data.

    Menentukan template metadata: membuat jenis aspek

    1. Di konsol Google Cloud , buka halaman Catalog Dataplex Universal Catalog.

      Buka Katalog

    2. Klik tab Jenis aspek & template tag, lalu klik tab Kustom.

    3. Klik Create aspect type.

    4. Di kolom ID jenis aspek, masukkan data-governance-demo.

    5. Untuk Lokasi, pilih global.

    6. Di bagian Template, klik Add field. Gunakan informasi dalam tabel berikut untuk menambahkan beberapa kolom ke jenis aspek:

      Nama Jenis Wajib diisi Deskripsi
      source-of-data-asset Teks Tidak -
      retention-date Tanggal dan waktu Tidak -
      data-classification

      Enum

      Tambahkan nilai Public, Sensitive, dan Confidential.

      Ya -
      has-pii Boolean Ya Whether the data asset has personally identifiable information
    7. Klik Simpan.

    Menambahkan metadata ke tabel: menambahkan aspek ke entri

    1. Di konsol Google Cloud , buka halaman Penelusuran Dataplex Universal Catalog.

      Buka Penelusuran

    2. Di kotak penelusuran, masukkan catalog_demo_dataset.

    3. Pilih tabel bike_stations.

    4. Menambahkan aspek kustom ke entri:

      1. Di bagian Tags & aspek, di samping Tag & aspek opsional, klik Tambahkan.

      2. Pilih jenis aspek data-governance-demo.

        Tindakan ini akan membuat aspek yang menggunakan jenis aspek Anda sebagai template.

      3. Masukkan nilai berikut:

        • Sumber aset data: Copied from NYC Citi Bike Trips public dataset
        • Tanggal retensi: masukkan tanggal.
        • Klasifikasi data: Public
        • Memiliki PII: False
      4. Klik Simpan.

    5. Untuk melihat nilai metadata yang Anda tambahkan, di bagian Tag & aspek, pilih aspek data-governance-demo.

    Pembersihan

    Agar akun Google Cloud Anda tidak dikenai biaya untuk resource yang digunakan pada halaman ini, ikuti langkah-langkah berikut.

    Menghapus project

    Cara termudah untuk menghentikan penagihan adalah dengan menghapus project yang Anda buat untuk panduan memulai ini.

    1. In the Google Cloud console, go to the Manage resources page.

      Go to Manage resources

    2. In the project list, select the project that you want to delete, and then click Delete.
    3. In the dialog, type the project ID, and then click Shut down to delete the project.

    Menghapus resource satu per satu

    Jika Anda ingin menggunakan kembali project, hapus resource yang Anda buat.

    1. Hapus set data:

      1. Di konsol Google Cloud , buka halaman BigQuery Studio.

        Buka BigQuery Studio

      2. Di panel Explorer, telusuri set data catalog_demo_dataset.

      3. Klik Lihat tindakan, lalu klik Hapus. Konfirmasi saat diminta.

    2. Hapus jenis aspek:

      1. Di konsol Google Cloud , buka halaman Catalog Dataplex Universal Catalog.

        Buka Katalog

      2. Klik tab Jenis aspek & template tag, lalu klik tab Kustom.

      3. Klik jenis aspek data-governance-demo.

      4. Klik Hapus. Konfirmasi saat diminta.

    Langkah berikutnya