Skip to main content

module ometa_api

OpenMetadata is the high level Python API that serves as a wrapper for the metadata-server API. It is based on the generated pydantic models from the JSON schemas and provides a typed approach to working with OpenMetadata entities.

Global Variables

  • ROUTES

class MissingEntityTypeException

We are receiving an Entity Type[T] not covered in our suffix generation list

class InvalidEntityException

We receive an entity not supported in an operation

class EmptyPayloadException

Raise when receiving no data, even if no exception during the API call is received

class OpenMetadata

Generic interface to the OpenMetadata API It is a polymorphism on all our different Entities. Specific functionalities to be inherited from Mixins

method __init__


method close

Closing connection Returns None

method compute_percentile

Compute an entity usage percentile

method create_or_update

We allow CreateEntity for PUT, so we expect a type C. We PUT to the endpoint and return the Entity generated result

method delete

API call to delete an entity from entity ID Args entity (T): entity Type entity_id (basic.Uuid): entity ID Returns None

method get_by_id

Return entity by ID or None

method get_by_name

Return entity by name or None

method get_create_entity_type

imports and returns the Create Type from an Entity Type T. We are following the expected path structure to import on-the-fly the necessary class and pass it to the consumer

method get_entity_from_create

Inversely, import the Entity type based on the create Entity class

method get_entity_reference

Helper method to obtain an EntityReference from a FQN and the Entity class. Args: entity: Entity Class fqn: Entity instance FQN Returns: EntityReference or None

method get_module_path

Based on the entity, return the module path it is found inside generated

method get_suffix

Given an entity Type from the generated sources, return the endpoint to run requests.

method health_check

Run version api call. Return true if response is not None

method list_all_entities

Utility method that paginates over all EntityLists to return a generator to fetch entities. Parameters:
  • entity: Entity Type, such as Table
  • fields: Extra fields to return
  • limit: Number of entities in each pagination
  • params: Extra parameters, e.g., {"service": "serviceName"} to filter
Returns: Generator that will be yielding all Entities

method list_entities

Helps us paginate over the collection

method list_services

Service listing does not implement paging

method list_versions

Version history of an entity

method update_file_name

Update the filename for services and schemas