Assign Tags¶
To assign tags to objects in Okera, you must have:
ALL
orADD_ATTRIBUTE and REMOVE_ATTRIBUTE
privilege for the data to which you want to assign tags.ALL
orADD_ATTRIBUTE
privilege on theATTRIBUTE NAMESPACE
from which you want to select tags to be assigned.
Using the UI¶
You can assign tags to a database, a dataset, or a dataset column.
Assign or Edit Database Tags¶
To assign a tag to a database using the UI:
-
Select Data on the UI side menu and then select the database you want to tag from the database list.
-
Select the
icon underneath the name and description of the database.
An input field appears with a drop-down list of available tags.
-
Search for and select the tag in the drop-down list that you want to assign the database.
You can also remove assigned tags by selecting the "x" next to the tag name in the input field.
-
Select
to save your tag selections when you have finished assigning tags to the database.
Tags assigned to a database display in the list of databases and at the top of the details page for the database.
Tags assigned to a dataset apply to all datasets in the database and all columns in its datasets. See Understanding Tag Inheritance.
Assign or Edit Dataset Tags¶
To assign a tag to a dataset using the UI:
-
Select Data on the UI side menu, select the database containing the dataset you want to tag, and then select the dataset from the dataset list.
-
Select the
icon underneath the name and description of the dataset.
An input field appears with a drop-down list of available tags.
-
Search for and select the tag in the drop-down list that you want to assign the dataset.
You can also remove assigned tags by selecting the "x" next to the tag name in the input field.
-
Select
to save your tag selections when you have finished assigning tags to the dataset.
Tags assigned to a dataset display in the list of datasets for the database, at the top of the details page for the dataset, and on the Details tab for the dataset.
Tags assigned to a dataset apply to all columns in the dataset. See Understanding Tag Inheritance.
Assign Dataset Column Tags¶
To assign a tag to a specific dataset column:
-
Select Data on the UI side menu, select the database containing the dataset you want to tag, select the dataset from the dataset list, and then select the Schema tab on the dataset details page.
-
Locate the column in the schema to which you want to add tags and select
in the Tags column.
Note: Tags cannot be assigned to partitioned columns or to nested fields of complex types.
An input field appears with a drop-down list of available tags.
-
Search for and select the tag in the drop-down list that you want to assign the column.
You can also remove assigned tags by selecting the "x" next to the tag name in the input field.
-
Select
to save your tag selections when you have finished assigning tags to a column.
Tags assigned to a column display in the schema for a dataset as well as on the Details tab for the dataset.
Edit Assigned Column Tags Using the UI¶
To edit the tags assigned to a dataset column using the UI, select the in the Tags column on the Schema tab.
Remove Assigned Tags¶
To remove tags assigned to a database, dataset, or dataset column, edit the database, dataset, or column tags (as described above) and select the "x" associated with the tag in the input field. Be sure to save the tags for the database, dataset, or column when you are done.
Using DDL¶
Create a Table With a Tag¶
CREATE TABLE users (
id BIGINT,
name STRING
)
ATTRIBUTE <namespace.tag>
Create a View With a Tag¶
CREATE VIEW sales.shipped_orders AS
SELECT *
FROM sales.transactions
WHERE status = 'Shipped'
ATTRIBUTE <namespace.tag>
Any tags set at the time a view is created are in addition to those that are inherited.
Assign a Tag to a Database¶
ALTER DATABASE <db> ADD|DROP ATTRIBUTE <namespace.tag>
Assign a Tag to a Table (Dataset) or View¶
ALTER TABLE|VIEW cerebro.sample ADD|DROP ATTRIBUTE <namespace.tag>;
Assign a Tag to a Dataset Column¶
ALTER TABLE|VIEW <dataset_name> ADD|DROP COLUMN ATTRIBUTE <column_name> <namespace.tag>;
Review Assigned Tags¶
Admins can view assigned tags as part of the metadata by running describe database <database_name>
or describe formatted <dataset_name>
.