user9910379
user9910379

Reputation: 205

Bulk Tag Bigquery columns with python & Google Cloud Datacatalog

Is there a way to bulk tag bigquery tables with python google.cloud.datacatalog?

Upvotes: 0

Views: 1665

Answers (2)

mesmacosta
mesmacosta

Reputation: 476

If you want to take a look at sample code which uses the python google.cloud.datacatalog client library, I've put together a utilities open source script, that creates bulk Tags using a CSV as source. If you want to use a different source, you may use this script as reference, hope it helps.

create bulk tags from csv

Upvotes: 1

Nick_Kh
Nick_Kh

Reputation: 5253

For this purpose you may consider using DataCatalogClient() method which is included in google.cloud.datacatalog_v1 class as a part of PyPI Python google-cloud-datacatalog package leveraging Google Cloud Data Catalog API service.

  • By the first, you have to enable Data Catalog and BigQuery APIs in your project;
  • Install Python Cloud Client Libraries for the Data Catalog API:

    pip install --upgrade google-cloud-datacatalog

  • Set up authentication, exporting GOOGLE_APPLICATION_CREDENTIALS environment variable holding JSON file that contains your service account key:

    export GOOGLE_APPLICATION_CREDENTIALS="/home/user/Downloads/[FILE_NAME].json"

  • Refer to this example from official documentation that intelligibly reflects a way creating Data catalog tag template, attaching appropriate tag fields to the target Bigquery table using create_tag_template() function.

Having any doubts feel free to extend you initial question or add a comment below this answer, thus we can address particular use case according to your needs.

Upvotes: 1

Related Questions