BigQuery テーブルにメタデータを追加する
Dataplex Universal Catalog でメタデータ管理を始める方法を学びます。
このクイックスタートでは、BigQuery テーブルにメタデータを追加する方法について説明します。このクイックスタートでは、次のことを行います。
一般公開データセットに基づいて BigQuery データセットとテーブルを作成します。
関連するメタデータ フィールドのセットを定義するテンプレートを作成します。
このテンプレートはアスペクト タイプと呼ばれます。データアセットのビジネス メタデータとテクニカル メタデータを記述する関連するメタデータ フィールドのセットは、アスペクトと呼ばれます。
テーブルにメタデータを追加します。
Dataplex Universal Catalog では、各データアセットはエントリとして表されます。メタデータをデータアセットにアタッチするには、エントリにアスペクトを追加します。
始める前に
- 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.
 - 
    
    
      
        
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 theresourcemanager.projects.createpermission. Learn how to grant roles. 
 - 
  
    
Verify that billing is enabled for your Google Cloud project.
 - 
  
  
    
      
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 theserviceusage.services.enablepermission. Learn how to grant roles. - 
    
        
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
- 
              
In the Google Cloud console, go to the IAM page.
Go to IAM - Select the project.
 - 
              
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.
 - 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
- 
              
In the Google Cloud console, go to the IAM page.
IAM に移動 - プロジェクトを選択します。
 - [ アクセスを許可] をクリックします。
 - 
              
[新しいプリンシパル] フィールドに、ユーザー ID を入力します。 これは通常、Google アカウントのメールアドレスです。
 - [ロールを選択] リストでロールを選択します。
 - 追加のロールを付与するには、 [別のロールを追加] をクリックして各ロールを追加します。
 - [保存] をクリックします。
 
 - 
              
 - 
    
    
      
        
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 theresourcemanager.projects.createpermission. Learn how to grant roles. 
 - 
  
    
Verify that billing is enabled for your Google Cloud project.
 - 
  
  
    
      
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 theserviceusage.services.enablepermission. Learn how to grant roles. - 
    
        
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
- 
              
In the Google Cloud console, go to the IAM page.
Go to IAM - Select the project.
 - 
              
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.
 - 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
- 
              
In the Google Cloud console, go to the IAM page.
IAM に移動 - プロジェクトを選択します。
 - [ アクセスを許可] をクリックします。
 - 
              
[新しいプリンシパル] フィールドに、ユーザー ID を入力します。 これは通常、Google アカウントのメールアドレスです。
 - [ロールを選択] リストでロールを選択します。
 - 追加のロールを付与するには、 [別のロールを追加] をクリックして各ロールを追加します。
 - [保存] をクリックします。
 
 - 
              
 Google Cloud コンソールで、[BigQuery Studio] ページに移動します。
データセットを作成します。
[エクスプローラ] ペインでプロジェクトを探します。(アクションを表示)をクリックしてから、[データセットを作成] をクリックします。
[データセット ID] フィールドに「
catalog_demo_dataset」と入力します。他のフィールドはデフォルト値を使用します。
[データセットを作成] をクリックします。
一般公開テーブルをデータセットにコピーします。
[エクスプローラ] ペインで、
bigquery-public-data.new_york_citibike.citibike_stationsという名前のテーブルを検索します。検索範囲にbigquery-public-dataプロジェクトを含めるように設定する必要がある場合があります。このテーブルは、シェアサイクル プログラムに関するデータを含む一般公開データセットである NYC Citi Bike Trips データセットの一部です。
citibike_stationsテーブルを選択します。[コピー] をクリックします。次の情報を入力します。
- プロジェクト: 該当プロジェクトを選択します。
 - データセット: 
catalog_demo_datasetを選択します。 - テーブル: 「
bike_stations」と入力します。 
[コピー] をクリックします。
[エクスプローラ] ペインで、
catalog_demo_datasetデータセットを見つけ、bike_stationsテーブルがデータセットに表示されていることを確認します。Google Cloud コンソールで、Dataplex Universal Catalog の [カタログ] ページに移動します。
[アスペクト タイプとタグ テンプレート] タブをクリックしてから、[カスタム] タブをクリックします。
[アスペクト タイプを作成する] をクリックします。
[アスペクト タイプ ID] フィールドに「
data-governance-demo」と入力します。[ロケーション] で、
globalを選択します。[テンプレート] セクションで、[フィールドを追加] をクリックします。次の表の情報を使用して、アスペクト タイプに複数のフィールドを追加します。
名前 タイプ 必須 説明 source-of-data-assetテキスト いいえ - retention-date日時 いいえ - data-classification列挙型
値
Public、Sensitive、Confidentialを追加します。はい - has-piiブール値 はい Whether the data asset has personally identifiable information[保存] をクリックします。
Google Cloud コンソールで、Dataplex Universal Catalog の [検索] ページに移動します。
[検索] ボックスに「
catalog_demo_dataset」と入力します。bike_stations テーブルを選択します。
エントリにカスタム アスペクトを追加します。
[タグとアスペクト] セクションで、[オプションのタグとアスペクト] の横にある [追加] をクリックします。
data-governance-demoアスペクト タイプを選択します。これにより、アスペクト タイプをテンプレートとして使用するアスペクトが作成されます。
次の値を入力します。
- データアセットのソース: 
Copied from NYC Citi Bike Trips public dataset - 保持日: 日付を入力します。
 - データ分類: 
Public - 個人情報(PII)あり: 
False 
- データアセットのソース: 
 [保存] をクリックします。
追加したメタデータ値を確認するには、[タグとアスペクト] セクションで data-governance-demo アスペクトを選択します。
- In the Google Cloud console, go to the Manage resources page.
 - In the project list, select the project that you want to delete, and then click Delete.
 - In the dialog, type the project ID, and then click Shut down to delete the project.
 データセットを削除します。
Google Cloud コンソールで、[BigQuery Studio] ページに移動します。
[エクスプローラ] ペインで、
catalog_demo_datasetデータセットを検索します。[ アクションを表示] をクリックしてから、[削除] をクリックします。表示されるメッセージを確認します。
アスペクト タイプを削除します。
Google Cloud コンソールで、Dataplex Universal Catalog の [カタログ] ページに移動します。
[アスペクト タイプとタグ テンプレート] タブをクリックしてから、[カスタム] タブをクリックします。
data-governance-demoアスペクト タイプをクリックします。[削除] をクリックします。表示されるメッセージを確認します。
- メタデータ管理 について詳細を確認する。
 - リソースを検索する方法を学習する。
 - アスペクトとアスペクト タイプを操作する方法を学習する。
 
データセットとテーブルを作成する
メタデータ テンプレートを定義する: アスペクト タイプを作成する
テーブルにメタデータを追加する: エントリにアスペクトを追加する
クリーンアップ
このページで使用したリソースについて、 Google Cloud アカウントに課金されないようにするには、次の手順を実施します。
プロジェクトの削除
課金を停止する最も簡単な方法は、このクイックスタート用に作成したプロジェクトを削除することです。
リソースを個別に削除する
プロジェクトを再利用する場合は、作成したリソースを削除します。