Tagging Dataplex Assets - GSP1145

Tagging Dataplex Assets - GSP1145

Overview

Dataplex is an intelligent data fabric that enables organizations to centrally discover, manage, monitor, and govern their data across data lakes, data warehouses, and data marts to power analytics at scale.

Data Catalog is a fully managed, scalable metadata management service within Dataplex that you can use to tag data assets and search for assets to which you have access. Tags allow you to attach custom metadata fields to specific data assets for easy identification and retrieval (such as tagging certain assets as containing protected or sensitive data); you can also create reusable tag templates to rapidly assign the same tags to different data assets.

In this lab, you learn how to use Data Catalog within Dataplex to create a tag template, apply it to Dataplex assets, and then use the tag to search for assets.

What you'll do

  • Enable the Dataplex and Data Catalog APIs

  • Create a lake, zone, and asset in Dataplex

  • Create a tag template

  • Apply a tag template to Dataplex assets

  • Search for assets using tags

Setup and requirements

Before you click the Start Lab button

Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources will be made available to you.

This hands-on lab lets you do the lab activities yourself in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials that you use to sign in and access Google Cloud for the duration of the lab.

To complete this lab, you need:

  • Access to a standard internet browser (Chrome browser recommended).

Note: Use an Incognito or private browser window to run this lab. This prevents any conflicts between your personal account and the Student account, which may cause extra charges incurred to your personal account.

  • Time to complete the lab---remember, once you start, you cannot pause a lab.

Note: If you already have your own personal Google Cloud account or project, do not use it for this lab to avoid extra charges to your account.

How to start your lab and sign in to the Google Cloud console

  1. Click the Start Lab button. If you need to pay for the lab, a pop-up opens for you to select your payment method. On the left is the Lab Details panel with the following:

    • The Open Google Cloud console button

    • Time remaining

    • The temporary credentials that you must use for this lab

    • Other information, if needed, to step through this lab

  2. Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).

    The lab spins up resources, and then opens another tab that shows the Sign in page.

    Tip: Arrange the tabs in separate windows, side-by-side.

    Note: If you see the Choose an account dialog, click Use Another Account.

  3. If necessary, copy the Username below and paste it into the Sign in dialog.

     student-04-03489f0ee74a@qwiklabs.net
    

    You can also find the Username in the Lab Details panel.

  4. Click Next.

  5. Copy the Password below and paste it into the Welcome dialog.

     EnJNzgDvIRWg
    

    You can also find the Password in the Lab Details panel.

  6. Click Next.

    Important: You must use the credentials the lab provides you. Do not use your Google Cloud account credentials.

    Note: Using your own Google Cloud account for this lab may incur extra charges.

  7. Click through the subsequent pages:

    • Accept the terms and conditions.

    • Do not add recovery options or two-factor authentication (because this is a temporary account).

    • Do not sign up for free trials.

After a few moments, the Google Cloud console opens in this tab.

Note: To view a menu with a list of Google Cloud products and services, click the Navigation menu at the top-left.

Navigation menu icon

Enable Dataplex and Data Catalog APIs

  1. In the Google Cloud Console, enter Cloud Dataplex API in the top search bar.

  2. Click on the result for Cloud Dataplex API under Marketplace.

  3. Click Enable.

  4. Repeat steps 1-3 for Google Cloud Data Catalog API.

Task 1. Create a lake, zone, and asset

In this task, you create a new Dataplex lake to store customer order information, add a curated zone to the lake, and then attach a pre-created BigQuery dataset as a new asset in the zone.

Create a lake

  1. In the Google Cloud Console, in the Navigation menu (

    Navigation menu

    ), navigate to Analytics > Dataplex.

If prompted Welcome to the new Dataplex experience, click Close.

  1. Under Manage lakes, click Manage.

  2. Click Create lake.

  3. Enter the required information to create a new lake:

PropertyValue
Display NameOrders Lake
IDLeave the default value.
Regionus-west1

Leave the other default values.

  1. Click Create.

It can take up to 3 minutes for the lake to be created.

Add a zone to the lake

  1. On the Manage tab, click on the name of your lake.

  2. Click Add zone.

  3. Enter the required information to create a new zone:

PropertyValue
Display NameCustomer Curated Zone
IDLeave the default value.
TypeCurated zone
Data locationsRegional

Leave the other default values.

For example, the option for Enable metadata discovery under Discovery settings is enabled by default and allows authorized users to discover the data in the zone.

  1. Click Create.

It can take up to 2 minutes for the zone to be created.

You can perform the next task once the status of the zone is Active.

Attach an asset to a zone

  1. On the Zones tab, click on the name of your zone.

  2. On the Assets tab, click Add assets.

  3. Click Add an asset.

  4. Enter the required information to attach a new asset:

PropertyValue
TypeBigQuery dataset
Display NameCustomer Details Dataset
IDLeave the default value.
Datasetqwiklabs-gcp-03-2f7cebe43b72.customers

Leave the other default values.

  1. Click Done.

  2. Click Continue.

  3. For Discovery settings, select Inherit to inherit the Discovery settings from the zone level, and then click Continue.

  4. Click Submit.

Create a lake, zone, and asset in Dataplex

Check my progress

Task 2. Create a tag template

To start tagging data, you first need to create one or more tag templates. A tag template can be a public or private tag template. When you create a new tag template, the option to create a public tag template is the default and recommended option. Users who have the required view permissions for a data asset can view all the public tags associated with it. This supports simple search for discovery while also adhering to data access controls already implemented on the underlying data.

In this task, you create a public tag template to label BigQuery table columns with a protected status. With a public tag template, users who have access to the underlying BigQuery table columns will be able to see the tags applied to the columns.

  1. On the left menu, under Manage Metadata, click Tag templates.

  2. Click Create tag template.

  3. Enter the required information to define the tag template:

PropertyValue
Template Display NameProtected Data Template
Template IDLeave the default value.
Locationus-west1
VisibilityPublic
  1. Click Add field, and enter the required information to add a new field to the template:
PropertyValue
Field Display NameProtected Data Flag
Field IDLeave the default value.
TypeEnumerated
  1. For Enumerated values > Values 1, enter YES.

  2. Click Add value, and for Values 2, enter NO.

  3. Click Done.

  4. Click Create.

Create a tag template

Check my progress

Task 3. Apply a tag template to Dataplex assets

After you create a tag template, you can use it to attach tags to any number of desired data assets to which you have access.

In this task, you apply your previously created tag template to specific columns in the BigQuery table that you want to label with a protected data status.

  1. On the left menu, under Discover, click Search.

  2. For Filters > Systems, enable the checkbox for Dataplex.

  3. Click on the customer_details table.

If you do not see the customer_details table, wait a few minutes and then refresh the page to allow the Dataplex asset list to be updated.

  1. Click Attach tags.

  2. For Choose what to tag, enable the checkboxes for the following columns:

    • zip

    • state

    • last_name

    • country

    • email

    • latitude

    • first_name

    • city

    • longitude

  3. Click OK.

  4. For Choose the tag templates, select Protected data template.

  5. For Protected data flag, select YES.

  6. Click Save.

Apply a tag template to Dataplex assets

Check my progress

Task 4. Search for assets using tags

After you have tagged data assets, you can search for them using Data Catalog within Dataplex.

In this task, you search for the assets that have been tagged using the Protected Data tag template.

  1. On the left menu, under Discover, click Search.

  2. For Filters > Tags, enable the checkbox for Protected data template.

  3. Click on the customer_details table.

  4. Click on the Schema and column tags tab to see the Protected Data tags on the specified columns.


Solution of Lab

export REGION=

curl -LO raw.githubusercontent.com/QUICK-GCP-LAB/2-Minutes-Labs-Solutions/main/Tagging%20Dataplex%20Assets/gsp1145.sh
sudo chmod +x gsp1145.sh
./gsp1145.sh

Task 3. Apply a tag template to Dataplex assets