Skip to main content

Python SDK for Tags

In this guide, we will use the Python SDK to create Tags. A prerequisite for this section is to have previously gone through the following docs. In the following sections we will:
  • Create a Database Service, a Database, a Schema and one Table,
  • Create a Classification,
  • Create a Tag for the Classification and add it to the Table.

Creating the Entities

To prepare the necessary ingredients, execute the following steps.

1. Preparing the Client

2. Creating the Database Service

We are mocking a MySQL instance. Note how we need to pass the right configuration class MysqlConnection, as a parameter for the generic DatabaseConnection type.

3. Creating the Database

Any Entity that is created and linked to another Entity, has to hold the fullyQualifiedName to the Entity it relates to. In this case, a Database is bound to a specific service.

4. Creating the Schema

The same happens with the Schemas. They are related to a Database.

5. Creating the Table

We are doing a simple example with a single column.

6. Creating the Classification

Classifications are the entities we use to group tag definitions. Let’s create a sample one:

7. Creating the Tag

Once there is an existing classification, we create tags within that given classification:

8. Tagging a Table

Now that we have the Tag, we can proceed and tag a specific asset. In this example, we’ll tag the Table we created above. The Python SDK exposes a helper method that handles the update:
If we now check the tags for the Table, the new tag will be appearing in there. If we can control the Tag creation process when the Table metadata is generated, we can also assign the tags in the tags property of CreateTableRequest.

9. Tagging a Column

The same idea can be replicated to tag a column: