in google-datacatalog-apache-atlas-connector/src/google/datacatalog_connectors/apache_atlas/prepare/datacatalog_tag_factory.py [0:0]
def make_tag_for_entity(self, entity, entity_types_dict, enum_types_dict):
tag = datacatalog.Tag()
guid = entity['guid']
data = entity['data']
entity_type_name = data['typeName']
entity_type = entity_types_dict[entity_type_name]
formatted_name = attr_normalizer.DataCatalogAttributeNormalizer.\
format_name(entity_type_name)
tag_template_id = attr_normalizer.DataCatalogAttributeNormalizer.\
create_tag_template_id(formatted_name,
constant.ENTITY_TYPE_PREFIX,
entity_type['data']['version'])
tag.template = datacatalog.DataCatalogClient.tag_template_path(
project=self.__project_id,
location=self.__location_id,
tag_template=tag_template_id)
attributes = data['attributes']
super()._set_bool_field(tag, formatted_name, True)
super()._set_string_field(tag, constant.ENTITY_GUID, guid)
super()._set_string_field(tag, constant.INSTANCE_URL_FIELD,
self.__instance_url)
attribute_defs = entity_type['data']['attributeDefs']
self.__add_fields_from_attributes(tag, attributes, attribute_defs,
enum_types_dict)
self.__create_custom_fields_for_entity_type(tag, entity_type_name,
attributes)
return tag