Add BigQuery policy tags

This document shows you how to add BigQuery policy tags to table columns with Dataform core.

You can set BigQuery policy tags on table columns in the config block in a table definition SQLX file.

Before you begin

  1. In the Cloud Console, go to the Dataform page.

    Go to the Dataform page

  2. Select or create a repository.

  3. Select or create a development workspace.

  4. Create a table.

Required roles

To get the permissions that you need to add a BigQuery policy tag to a table in Dataform, ask your administrator to grant you the Dataform Editor (roles/dataform.editor) IAM role on workspaces. For more information about granting roles, see Manage access.

You might also be able to get the required permissions through custom roles or other predefined roles.

Add a BigQuery policy tag

To add a BigQuery policy tag to a table column, follow these steps:

  1. Go to your development workspace.
  2. In the Files pane, expand definitions/.
  3. Select a table definition SQLX file.
  4. In the config block, add a full tag identifier to a selected column in the following format:

    columns: {
        column_name: {
          bigqueryPolicyTags: ["FULL_TAG_IDENTIFIER"]
        }
      }
    

    Replace FULL_TAG_IDENTIFIER with the full identifier of the selected tag.

  5. Optional: Click Format.

The following code sample shows the projects/example-project/locations/us/taxonomies/123456789/policyTags/123456789 sample BigQuery policy tag added to column1:

config {
  type: "table",
  columns: {
    column1: {
      description: "Some description",
      bigqueryPolicyTags: ["projects/example-project/locations/us/taxonomies/123456789/policyTags/123456789"]
    }
  }
}

SELECT "test" AS column1

What's next