Reputation: 205
Is there a way to bulk tag bigquery tables with python google.cloud.datacatalog?
Upvotes: 0
Views: 1665
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.
Upvotes: 1
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.
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