Skip to main content

A package to manage Google Cloud Data Catalog tags, loading metadata from external sources

Project description

datacatalog-tag-manager

A Python package to manage Google Cloud Data Catalog tags, loading metadata from external sources. Currently supports the CSV file format.

CircleCI

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.updateTag and bigquery.tables.updateTag permissions

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

The metadata schema to create Tags is described below. Use as many lines as needed to create all the Tags and Fields you need.

Column Description Mandatory
linked_resource Full name of the asset the Entry refers to 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

TIPS

2.1.1. From a CSV file

  • Python + virtualenv
datacatalog-tag-manager create-tags --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 create-tags --csv-file /data/CSV_FILE_NAME

2.2. Delete

The metadata schema to delete Tags is described below. Use as many lines as needed to delete all the Tags you want.

Column Description Mandatory
linked_resource Full name of the asset the Entry refers to 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

TIPS

2.2.1. From a CSV file

  • Python + virtualenv
datacatalog-tag-manager delete-tags --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-tags --csv-file /data/CSV_FILE_NAME

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datacatalog-tag-manager-0.2.4.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

datacatalog_tag_manager-0.2.4-py2.py3-none-any.whl (9.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file datacatalog-tag-manager-0.2.4.tar.gz.

File metadata

  • Download URL: datacatalog-tag-manager-0.2.4.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9

File hashes

Hashes for datacatalog-tag-manager-0.2.4.tar.gz
Algorithm Hash digest
SHA256 bb542c0e13795e96bc83b8913cc0c011202269272bcdcab97e4afe50ceeeaf5e
MD5 0d6b591f4f31bd539648dd457666740d
BLAKE2b-256 0ded5f237c6f343fefc4011387e3266592892ad6af2283a65f84eaafc85413ee

See more details on using hashes here.

File details

Details for the file datacatalog_tag_manager-0.2.4-py2.py3-none-any.whl.

File metadata

  • Download URL: datacatalog_tag_manager-0.2.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9

File hashes

Hashes for datacatalog_tag_manager-0.2.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3817055237e3e1cc582c277959882188b35530926abf181a1e7f5f6ff6c78e51
MD5 f63143698297821d4c2d1b620229db28
BLAKE2b-256 0bd0aac11efc5352bfad311dd268b294aa1527b8ed1455180ad7b6a8b85267b6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page