This document explains how to use the entry link export utility to extract entry links (relationships between glossary terms and data assets) from Knowledge Catalog (formerly Dataplex Universal Catalog) into a Google Sheet.
You can export entry links to a Google Sheet to audit existing links, back up your metadata, or prepare a template for bulk updates.
Before you begin
Before you export entry links to a Google Sheet, complete the following prerequisites.
Set up the service account
To run the export utility, you must set up a service account with the necessary permissions to access the Google Sheets API and impersonate your user credentials:
Identify or create a service account.
Select an existing service account or create a new one in the project where you run the import utility. For more information, see Create service accounts. Note the service account email (for example,
SERVICE_ACCOUNT_NAME@PROJECT_ID.iam.gserviceaccount.com).Configure service account impersonation.
To run the export utility script locally, your user account must have permission to impersonate the service account. Grant your user account the Service Account Token Creator role (
roles/iam.serviceAccountTokenCreator) on the service account.For more information, see Manage access to service accounts.
Grant the service account
Editoraccess to the Google Sheet.Open the Google Sheet you want to use for the import process, click Share, and add the service account email as an
Editor. This permission enables the service account to read from or write data to your sheet.
Required roles
To ensure that the service account has the necessary permissions to export entry links to a Google Sheet, ask your administrator to grant the following IAM roles to the service account:
- Dataplex Administrator (
roles/dataplex.admin) on the project - Dataplex Catalog Admin (
roles/dataplex.catalogAdmin) on the project - Dataplex Catalog Editor (
roles/dataplex.catalogEditor) on the project
For more information about granting roles, see Manage access to projects, folders, and organizations.
Your administrator might also be able to give the service account the required permissions through custom roles or other predefined roles.
Enable APIs
To export entry links, enable the following APIs in your project:
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.
Set up the git repository
Clone the dataplex-labs repository:
git clone https://github.com/GoogleCloudPlatform/dataplex-labs.git cd dataplex-labs/dataplex-quickstart-labs/00-resources/scripts/python/business-glossary-import/dataplex-glossary/export
Install dependencies
Install the required Python dependencies:
pip3 install -r requirements.txt cd dataplex-glossary
If you encounter any issues with the package installation, set up a new Python development environment.
Authenticate and configure service account impersonation
Initialize the Google Cloud CLI and authenticate using Application Default Credentials (ADC) with service account impersonation:
# Set your service account email address SA_EMAIL="SERVICE_ACCOUNT_EMAIL" # Authenticate ADC using service account impersonation and required scopes gcloud init gcloud auth login gcloud auth application-default login \ --impersonate-service-account="${SA_EMAIL}" \ --scopes="https://www.googleapis.com/auth/spreadsheets"
Replace SERVICE_ACCOUNT_EMAIL with the service account email ID. For example:
SERVICE_ACCOUNT_NAME@PROJECT_ID.iam.gserviceaccount.com
Set up the target Google Sheet for export
Create an empty Google Sheet or use an existing one. The export script writes to
the first sheet. Ensure that you have granted the service account Editor
access to the Google Sheet.
Set up environment variables
Set up the following environment variables:
# Set your glossary URL export GLOSSARY_URL="GLOSSARY_URL" # Set your Google Sheet URL export SPREADSHEET_URL="GOOGLE_SHEET_URL" # Set the project ID export USER_PROJECT="USER_PROJECT"
Export entry links to the Google Sheet
To export entry links in a glossary to the Google Sheet, run the following script:
cd export python3 entrylinks-export.py \ --glossary-url="$GLOSSARY_URL" \ --spreadsheet-url="$SPREADSHEET_URL" \ --user-project="$USER_PROJECT"
You can review the execution logs in the logs/ directory in your local
execution path. These logs help you audit the transfer process and identify
skipped entries or formatting warnings.
Verify the exported entry links data
The export script populates the Google Sheet with the following columns:
| Column header | Description |
|---|---|
entry_link_type |
The type of entry link (definition, related, or
synonym). |
source_entry |
The full resource path of the source entry. |
target_entry |
The full resource path of the target entry. |
source_path |
Column or field path for definition links. |
What's next
- Learn how to manage a business glossary.
- Learn how to import entry links from a Google Sheet.
- Learn how to export glossaries to a Google Sheet.
- Learn more about metadata management.