datacatalog-tag-manager
A Python package to manage Google Cloud Data Catalog tags, loading metadata from external sources. Currently supports the CSV file format.
Table of Contents
1. Environment setup
1.1. Python + virtualenv
Using virtualenv is optional, but strongly recommended unless you use Docker.
1.1.1. Install Python 3.6+
1.1.2. Create a folder
This is recommended so all related stuff will reside at same place, making it easier to follow below instructions.
mkdir ./datacatalog-tag-manager
cd ./datacatalog-tag-manager
All paths starting with ./ in the next steps are relative to the datacatalog-tag-manager
folder.
1.1.3. Create and activate an isolated Python environment
pip install --upgrade virtualenv
python3 -m virtualenv --python python3 env
source ./env/bin/activate
1.1.4. Install the package
pip install --upgrade datacatalog-tag-manager
1.2. Docker
Docker may be used as an alternative to run datacatalog-tag-manager. In this case, please
disregard the above virtualenv setup instructions.
1.2.1. Get the source code
git clone https://github.com/ricardolsmendes/datacatalog-tag-manager
cd ./datacatalog-tag-manager
1.3. Auth credentials
1.3.1. Create a service account and grant it below roles
- BigQuery Metadata Viewer
- Data Catalog TagTemplate User
- A custom role with
bigquery.datasets.updateTagandbigquery.tables.updateTagpermissions
1.3.2. Download a JSON key and save it as
./credentials/datacatalog-tag-manager.json
1.3.3. Set the environment variables
This step may be skipped if you're using Docker.
export GOOGLE_APPLICATION_CREDENTIALS=./credentials/datacatalog-tag-manager.json
2. Manage Tags
2.1. Create or Update
2.1.1. From a CSV file
- SCHEMA
The metadata schema to create or update Tags is presented below. Use as many lines as needed to describe all the Tags and Fields you need.
| Column | Description | Mandatory |
|---|---|---|
| linked_resource OR entry_name | Full name of the BigQuery or PubSub asset the Entry refers to, or an Entry name if you are working with Custom Entries | yes |
| template_name | Resource name of the Tag Template for the Tag | yes |
| column | Attach Tags to a column belonging to the Entry schema | no |
| field_id | Id of the Tag field | yes |
| field_value | Value of the Tag field | yes |
- SAMPLE INPUT
- sample-input/upsert-tags for reference;
- Data Catalog Sample Tags (Google Sheets) might help to create/export a CSV file.
- COMMANDS
Python + virtualenv
datacatalog-tags upsert --csv-file <CSV-FILE-PATH>
Docker
docker build --rm --tag datacatalog-tag-manager .
docker run --rm --tty \
--volume <CREDENTIALS-FILE-FOLDER>:/credentials --volume <CSV-FILE-FOLDER>:/data \
datacatalog-tag-manager upsert --csv-file /data/<CSV-FILE-PATH>
2.2. Delete
2.2.1. From a CSV file
- SCHEMA
The metadata schema to delete Tags is presented below. Use as many lines as needed to delete all the Tags you want.
| Column | Description | Mandatory |
|---|---|---|
| linked_resource OR entry_name | Full name of the BigQuery or PubSub asset the Entry refers to, or an Entry name if you are working with Custom Entries | yes |
| template_name | Resource name of the Tag Template of the Tag | yes |
| column | Delete Tags from a column belonging to the Entry schema | no |
- SAMPLE INPUT
- sample-input/delete-tags for reference;
- Data Catalog Sample Tags (Google Sheets) might help to create/export a CSV file.
- COMMANDS
Python + virtualenv
datacatalog-tags delete --csv-file <CSV-FILE-PATH>
Docker
docker build --rm --tag datacatalog-tag-manager .
docker run --rm --tty \
--volume <CREDENTIALS-FILE-FOLDER>:/credentials --volume <CSV-FILE-FOLDER>:/data \
datacatalog-tag-manager delete --csv-file /data/<CSV-FILE-PATH>
Metadata
Release files for datacatalog-tag-manager 2.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| datacatalog-tag-manager-2.2.0.tar.gz | 10.6 kB | Without provenance | Details for datacatalog-tag-manager-2.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| datacatalog_tag_manager-2.2.0-py3-none-any.whl | Python 3 | none | any | Details for datacatalog_tag_manager-2.2.0-py3-none-any.whl |
Total release size: 21.5 kB
Release files / datacatalog-tag-manager-2.2.0.tar.gz
| Download URL | datacatalog-tag-manager-2.2.0.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ddbbb080dbb539d01a426d4ab4098d203165e0faa69d1bb9354ab991eb11d1f2
|
|
BLAKE2b-256 checksum How to use checksums |
4273293425c5ad461f522ed2e1aaea4a7c8b7f776d138b67191f268e988bce31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.12
|
Release files / datacatalog_tag_manager-2.2.0-py3-none-any.whl
| Download URL | datacatalog_tag_manager-2.2.0-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3554246a5498b0d60698160d772e49cfa13e2b04bab8b2ff2e584425a5106660
|
|
BLAKE2b-256 checksum How to use checksums |
df3bd6a8515d7388c21217006d4bbf772bb9a6b45a88360f79ceb60a234aaf56
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.12
|
Security for datacatalog-tag-manager 2.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.