BigQuery テーブルにメタデータを追加する

Dataplex Universal Catalog でメタデータ管理を始める方法を学びます。

このクイックスタートでは、BigQuery テーブルにメタデータを追加する方法について説明します。このクイックスタートでは、次のことを行います。

  1. 一般公開データセットに基づいて BigQuery データセットとテーブルを作成します。

  2. 関連するメタデータ フィールドのセットを定義するテンプレートを作成します。

    このテンプレートはアスペクト タイプと呼ばれます。データアセットのビジネス メタデータとテクニカル メタデータを記述する関連するメタデータ フィールドのセットは、アスペクトと呼ばれます。

  3. テーブルにメタデータを追加します。

    Dataplex Universal Catalog では、各データアセットはエントリとして表されます。メタデータをデータアセットにアタッチするには、エントリにアスペクトを追加します。

始める前に

  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.

      IAM に移動
    2. プロジェクトを選択します。
    3. [ アクセスを許可] をクリックします。
    4. [新しいプリンシパル] フィールドに、ユーザー ID を入力します。 これは通常、Google アカウントのメールアドレスです。

    5. [ロールを選択] リストでロールを選択します。
    6. 追加のロールを付与するには、 [別のロールを追加] をクリックして各ロールを追加します。
    7. [保存] をクリックします。
  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.

      IAM に移動
    2. プロジェクトを選択します。
    3. [ アクセスを許可] をクリックします。
    4. [新しいプリンシパル] フィールドに、ユーザー ID を入力します。 これは通常、Google アカウントのメールアドレスです。

    5. [ロールを選択] リストでロールを選択します。
    6. 追加のロールを付与するには、 [別のロールを追加] をクリックして各ロールを追加します。
    7. [保存] をクリックします。
  10. データセットとテーブルを作成する

    1. Google Cloud コンソールで、[BigQuery Studio] ページに移動します。

      BigQuery Studio に移動

    2. データセットを作成します。

      1. [エクスプローラ] ペインでプロジェクトを探します。アクションを表示)をクリックしてから、[データセットを作成] をクリックします。

      2. [データセット ID] フィールドに「catalog_demo_dataset」と入力します。

        他のフィールドはデフォルト値を使用します。

      3. [データセットを作成] をクリックします。

    3. 一般公開テーブルをデータセットにコピーします。

      1. [エクスプローラ] ペインで、bigquery-public-data.new_york_citibike.citibike_stations という名前のテーブルを検索します。検索範囲に bigquery-public-data プロジェクトを含めるように設定する必要がある場合があります。

        このテーブルは、シェアサイクル プログラムに関するデータを含む一般公開データセットである NYC Citi Bike Trips データセットの一部です。

      2. citibike_stations テーブルを選択します。

      3. [コピー] をクリックします。次の情報を入力します。

        • プロジェクト: 該当プロジェクトを選択します。
        • データセット: catalog_demo_dataset を選択します。
        • テーブル: 「bike_stations」と入力します。
      4. [コピー] をクリックします。

    4. [エクスプローラ] ペインで、catalog_demo_dataset データセットを見つけ、bike_stations テーブルがデータセットに表示されていることを確認します。

    メタデータ テンプレートを定義する: アスペクト タイプを作成する

    1. Google Cloud コンソールで、Dataplex Universal Catalog の [カタログ] ページに移動します。

      カタログに移動

    2. [アスペクト タイプとタグ テンプレート] タブをクリックしてから、[カスタム] タブをクリックします。

    3. [アスペクト タイプを作成する] をクリックします。

    4. [アスペクト タイプ ID] フィールドに「data-governance-demo」と入力します。

    5. [ロケーション] で、global を選択します。

    6. [テンプレート] セクションで、[フィールドを追加] をクリックします。次の表の情報を使用して、アスペクト タイプに複数のフィールドを追加します。

      名前 タイプ 必須 説明
      source-of-data-asset テキスト いいえ -
      retention-date 日時 いいえ -
      data-classification

      列挙型

      PublicSensitiveConfidential を追加します。

      はい -
      has-pii ブール値 はい Whether the data asset has personally identifiable information
    7. [保存] をクリックします。

    テーブルにメタデータを追加する: エントリにアスペクトを追加する

    1. Google Cloud コンソールで、Dataplex Universal Catalog の [検索] ページに移動します。

      検索に移動

    2. [検索] ボックスに「catalog_demo_dataset」と入力します。

    3. bike_stations テーブルを選択します。

    4. エントリにカスタム アスペクトを追加します。

      1. [タグとアスペクト] セクションで、[オプションのタグとアスペクト] の横にある [追加] をクリックします。

      2. data-governance-demo アスペクト タイプを選択します。

        これにより、アスペクト タイプをテンプレートとして使用するアスペクトが作成されます。

      3. 次の値を入力します。

        • データアセットのソース: Copied from NYC Citi Bike Trips public dataset
        • 保持日: 日付を入力します。
        • データ分類: Public
        • 個人情報(PII)あり: False
      4. [保存] をクリックします。

    5. 追加したメタデータ値を確認するには、[タグとアスペクト] セクションで data-governance-demo アスペクトを選択します。

    クリーンアップ

    このページで使用したリソースについて、 Google Cloud アカウントに課金されないようにするには、次の手順を実施します。

    プロジェクトの削除

    課金を停止する最も簡単な方法は、このクイックスタート用に作成したプロジェクトを削除することです。

    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.

    リソースを個別に削除する

    プロジェクトを再利用する場合は、作成したリソースを削除します。

    1. データセットを削除します。

      1. Google Cloud コンソールで、[BigQuery Studio] ページに移動します。

        BigQuery Studio に移動

      2. [エクスプローラ] ペインで、catalog_demo_dataset データセットを検索します。

      3. [ アクションを表示] をクリックしてから、[削除] をクリックします。表示されるメッセージを確認します。

    2. アスペクト タイプを削除します。

      1. Google Cloud コンソールで、Dataplex Universal Catalog の [カタログ] ページに移動します。

        カタログに移動

      2. [アスペクト タイプとタグ テンプレート] タブをクリックしてから、[カスタム] タブをクリックします。

      3. data-governance-demo アスペクト タイプをクリックします。

      4. [削除] をクリックします。表示されるメッセージを確認します。

    次のステップ