treeschema.api.client

class APIClient(*args, **kwargs)

Bases: object

The underlying client that manages all interactions with the Tree Schema REST API.

add_tag_to_data_schema(data_store_id, data_schema_id, tags) → bool

Adds tags to a data schema via the Tree Schema API

add_tag_to_data_store(data_store_id, tags) → bool

Adds tags to a data store via the Tree Schema API

add_tag_to_field(data_store_id, data_schema_id, field_id, tags) → bool

Adds tags to a data schema via the Tree Schema API

add_tag_to_transformation(transformation_id, tags) → bool

Adds tags to a data store via the Tree Schema API

batch_retrieve_assets(assets) → Dict

Creates a data store via the Tree Schema API

check_transformation_breaking_change(transformation_id, links, max_depth=5)

Checks to see if the list of links provided for a given Transformation will cause any breaking changes.

create_data_field(data_store_id: int, data_schema_id: int, data_field_info) → bool
create_data_schema(data_store_id, data_schema_info) → bool

Creates a data schema via the Tree Schema API

create_data_store(data_store_info) → Dict

Creates a data store via the Tree Schema API

create_field_value(data_store_id: int, data_schema_id: int, field_id: int, field_value_info: dict) → bool
create_transformation(transformation_info) → Dict

Creates a data store via the Tree Schema API

Gets or creates a list of links via the Tree Schema API. Optionally will set the state of the transformaiton such that the transformation contains exactly the links that were provided via the API

delete_fields_from_schema(data_store_id, data_schema_id, delete_fields) → bool

Deletes (deprecates) a list of schemas from a data store via the Tree Schema API

Deletes (deprecates) a list of schemas from a data store via the Tree Schema API

delete_schemas_from_data_store(data_store_id, delete_schemas) → bool

Deletes (deprecates) a list of schemas from a data store via the Tree Schema API

get_all_data_stores() → Dict

Retrieves a data store from the Tree Schema API

get_all_fields_for_schema(data_store_id: int, data_schema_id: int) → List[Dict]
get_all_schemas_for_data_store(data_store_id) → List[Dict]

Creates a data store via the Tree Schema API

get_all_transformations() → Dict

Retrieves a data store from the Tree Schema API

get_all_users() → Dict

Retrieves all users in the user’s organization

get_all_values_for_field(data_store_id, data_schema_id, field_id) → List[Dict]

Retrieves all of the sample values for a given field

get_data_field_by_id(data_store_id: int, data_schema_id: int, field_id: int) → Dict[str, Any]
get_data_field_by_name(data_store_id: int, data_schema_id: int, name: str) → Dict[str, Any]

Retrieves a single schema from a data store via the Tree Schema API

get_data_schema_by_id(data_store_id: int, data_schema_id: int) → Dict[str, Any]

Retrieves a single schema from a data store via the Tree Schema API

get_data_schema_by_name(data_store_id: int, name: str) → Dict[str, Any]

Retrieves a single schema from a data store via the Tree Schema API

get_data_schema_tags(data_store_id, data_schema_id) → Dict[str, List[str]]

Returns an object that contains the list of tags for a data schema

get_data_store_by_id(data_store_id) → Dict[str, Any]

Retrieves a data store from the Tree Schema API

get_data_store_by_name(name) → Dict[str, Any]

Retrieves a data store from the Tree Schema API

get_data_store_tags(data_store_id) → Dict[str, List[str]]

Returns an object that contains the list of tags for a data store

get_dbt_parse_status(dbt_process_id) → str

Retrieves the status of the dbt parse instance.

get_field_tags(data_store_id, data_schema_id, field_id) → Dict[str, List[str]]

Returns an object that contains the list of tags for a data field

get_field_value_by_id(data_store_id: int, data_schema_id: int, field_id: int, field_value_id: int) → Dict[str, Any]

Rertieves a field value via the Tree Schema API

get_field_value_by_name(data_store_id: int, data_schema_id: int, field_id: int, value: str) → Dict[str, Any]

Retrieves a single schema from a data store via the Tree Schema API

get_transformation_by_id(transformation_id) → Dict[str, Any]

Retrieves a data store from the Tree Schema API

get_transformation_by_name(name: str) → Dict[str, Any]

Retrieves a transformation via the Tree Schema API

Deletes (deprecates) a list of schemas from a data store via the Tree Schema API

get_transformation_tags(transformation_id) → Dict[str, List[str]]

Returns an object that contains the list of tags for transformation

get_user(user_id: int, email: str = None) → Dict

Retrieves a user

get_user_by_email(email: str)

Retrieves a user from their email

parse_dbt_file(data_store_id, manifest_content) → str

Sends a dbt manifest file to Tree Schema to be parsed. Returns the dbt_update_id that is used to represent the parse instance and can be used to get the status later.

remove_data_schema_tags(data_store_id, data_schema_id, tags) → Dict[str, List[str]]

Removes a list of tags from a data store

remove_data_store_tags(data_store_id, tags) → Dict[str, List[str]]

Removes a list of tags from a data store

remove_field_tags(data_store_id, data_schema_id, field_id, tags) → Dict[str, List[str]]

Removes a list of tags from a data store

remove_transformation_tags(transformation_id, tags) → Dict[str, List[str]]

Removes a list of tags from a data store

save_dbt_results(dbt_process_id: str, add_schemas_fields: bool = False, update_descriptions: bool = False, update_tags: bool = True, add_lineage: bool = True) → str

Retrieves the status of the dbt parse instance.

Parameters
  • dbt_process_id – unique ID for the parse instance

  • add_schemas_fields – whether or not to add the manifest schemas and fields

  • update_descriptions – whether or not to update descriptions from the manifest

  • update_tags – whether or not to update tags from the manifest

  • add_lineage – whether or not to add data lineage from the manifest

update_field(data_store_id: int, data_schema_id: int, field_id: int, field_updates: dict) → Dict
update_field_value(data_store_id: int, data_schema_id: int, field_id: int, field_value_id: int, field_value_updates: dict) → Dict
update_schema(data_store_id: int, data_schema_id: int, schema_updates: dict) → Dict