CustomMetadataCache#

class pyatlan.cache.custom_metadata_cache.CustomMetadataCache(typedef_client: TypeDefClient)[source]#

Lazily-loaded cache for translating between Atlan-internal ID strings and human-readable names for custom metadata (including attributes).

classmethod get_all_custom_attributes(include_deleted: bool = False, force_refresh: bool = False) Dict[str, List[AttributeDef]][source]#

Retrieve all the custom metadata attributes. The dict will be keyed by custom metadata set name, and the value will be a listing of all the attributes within that set (with all the details of each of those attributes).

Parameters:
  • include_deleted – if True, include the archived (deleted) custom attributes; otherwise only include active custom attributes

  • force_refresh – if True, will refresh the custom metadata cache; if False, will only refresh the cache if it is empty

Returns:

a dict from custom metadata set name to all details about its attributes

Raises:

NotFoundError – if the custom metadata cannot be found

classmethod get_attr_id_for_name(set_name: str, attr_name: str) str[source]#

Translate the provided human-readable custom metadata set and attribute names to the Atlan-internal ID string for the attribute.

Parameters:
  • set_name – human-readable name of the custom metadata set

  • attr_name – human-readable name of the attribute

Returns:

Atlan-internal ID string for the attribute

Raises:

NotFoundError – if the custom metadata attribute cannot be found

classmethod get_attr_name_for_id(set_id: str, attr_id: str) str[source]#

Given the Atlan-internal ID string for the set and the Atlan-internal ID for the attribute return the human-readable custom metadata name for the attribute.

Parameters:
  • set_id – Atlan-internal ID string for the custom metadata set

  • attr_id – Atlan-internal ID string for the attribute

Returns:

human-readable name of the attribute

Raises:

NotFoundError – if the custom metadata attribute cannot be found

classmethod get_attribute_def(attr_id: str) AttributeDef[source]#

Retrieve a specific custom metadata attribute definition by its unique Atlan-internal ID string.

Parameters:

attr_id – Atlan-internal ID string for the custom metadata attribute

Returns:

attribute definition for the custom metadata attribute

Raises:
classmethod get_attribute_for_search_results(set_name: str, attr_name: str) str | None[source]#

Retrieve a single custom attribute name to include on search results.

Parameters:
  • set_name – human-readable name of the custom metadata set for which to retrieve the custom metadata attribute name

  • attr_name – human-readable name of the attribute

Returns:

the attribute name, strictly useful for inclusion in search results

classmethod get_attributes_for_search_results(set_name: str) List[str] | None[source]#

Retrieve the full set of custom attributes to include on search results.

Parameters:

set_name – human-readable name of the custom metadata set for which to retrieve attribute names

Returns:

a list of the attribute names, strictly useful for inclusion in search results

classmethod get_custom_metadata_def(name: str) CustomMetadataDef[source]#

Retrieve the full custom metadata structure definition.

Parameters:

name – human-readable name of the custom metadata set

Returns:

the full custom metadata structure definition for that set

Raises:
classmethod get_id_for_name(name: str) str[source]#

Translate the provided human-readable custom metadata set name to its Atlan-internal ID string.

Parameters:

name – human-readable name of the custom metadata set

Returns:

Atlan-internal ID string of the custom metadata set

Raises:
classmethod get_name_for_id(idstr: str) str[source]#

Translate the provided Atlan-internal custom metadata ID string to the human-readable custom metadata set name.

Parameters:

idstr – Atlan-internal ID string of the custom metadata set

Returns:

human-readable name of the custom metadata set

Raises:
classmethod is_attr_archived(attr_id: str) bool[source]#

Determine if an attribute is archived :param attr_id: Atlan-internal ID string for the attribute :returns: True if the attribute has been archived

classmethod refresh_cache() None[source]#

Refreshes the cache of custom metadata structures by requesting the full set of custom metadata structures from Atlan. :raises LogicError: if duplicate custom attributes are detected