How can I list tags en Google Data Catalog?

766 Views Asked by At

I'm creating tag templates programmatically and it doesn't appear in the section "Tag Templates" (the creation of each tag template was successful because I can attach it in each table), but when I create those tag templates by hand, they appear as a list.

Btw I'm trying to list the tag templates that I created, with the following sentence:

tag_list = datacatalog.list_tags(parent=f"projects/{project_id}/locations/{location}")

but when I print it says

google.api_core.exceptions.InvalidArgument: 400 Malformed Data Catalog resource name projects/sybogames-analytics-dev/locations/us.

anyone knows why?

thanks in advance.

1

There are 1 best solutions below

1
On

I'm unfamiliar with the Data Catalog service but, looking at the possible methods in APIs Explorer, I think (!?) you may need to terminate parent with /entrygroup/{entrygroup}.

There are 2 (!?) possible methods for list_tags:

  1. entryGroups.entries.tag_list
  2. entryGroup.tags.list

Both define parent similarly and require /entryGroups/{entrygroup}:

The resource can be an Entry or an EntryGroup (without /entries/{entries} at the end). It takes the form projects/{project}/locations/{location}/entryGroups/{entrygroup}/entries/{entries}.

You can use APIs Explorer to invoke either method to test it.

You can also use gcloud data-catalog tags list and, if you append --log-http to it, you'll be able to see exactly what underlying REST call is being made.