Support Questions

Find answers, ask questions, and share your expertise

Is it possible in Apache Atlas to add key-value pairs to entities metadata?

avatar
Explorer

Hello,

For instance, a user wants to add some key-values attributes or annotations to a table, field, entity without using traits or terms?

Thank you!

1 ACCEPTED SOLUTION

avatar

@Héctor Pérez Arteaga

First let's cover Entities vs Types. Think of this the same way as the relation between Object and Class in Object-Oriented Program. The "Entity" (your table) is an instance of "Type" (hive_table). As such, an Entity can only contain attributes defined in the "Type".

You can add metadata/attributes to an Entity (e.g. my_demo_table) using the REST API. However, you must first update the "Type" (e.g. hive_table) first with that particular attribute.

So, for example, if you would like to add a new attribute called "Department" to a particular table, then you would have to add that attribute first in "hive_table" Type. After that you would be able to set the attribute value in your Entity "my_demo_table".

View solution in original post

5 REPLIES 5

avatar

@Héctor Pérez Arteaga

First let's cover Entities vs Types. Think of this the same way as the relation between Object and Class in Object-Oriented Program. The "Entity" (your table) is an instance of "Type" (hive_table). As such, an Entity can only contain attributes defined in the "Type".

You can add metadata/attributes to an Entity (e.g. my_demo_table) using the REST API. However, you must first update the "Type" (e.g. hive_table) first with that particular attribute.

So, for example, if you would like to add a new attribute called "Department" to a particular table, then you would have to add that attribute first in "hive_table" Type. After that you would be able to set the attribute value in your Entity "my_demo_table".

avatar
Explorer

Thank you. Is it possible to add a tag to "hive_table" type? So business users can edit the tag on the go and also the attributes assigned to all hive tables. Is it possible to use this work around?

avatar

You can create a Tag that accepts attributes. For example, an "Expiry_Date" tag that contains an attribute named "date". You can associate that tag directly to your table or column. At the time of association, the user will be asked to fill out the "date" value for that particular entity/instance.

So, yes, this could be a workaround.

avatar
Explorer

ok, can I add a tag directly to the type? So, for example, each hive_table has Exp_Date tag.

avatar

No, tags are associated to entities. If you want something associated with a type then just add an attribute to it.