Projects

Attribute Configurations

Attribute Configuration

class tamr_unify_client.project.attribute_configuration.resource.AttributeConfiguration(client, data, alias=None)[source]

The configurations of Tamr Attributes.

See https://docs.tamr.com/reference#the-attribute-configuration-object

property relative_id
Type

str

property id
Type

str

property relative_attribute_id
Type

str

property attribute_role
Type

str

property similarity_function
Type

str

property enabled_for_ml
Type

bool

property tokenizer
Type

str

property numeric_field_resolution
Type

list

property attribute_name
Type

str

spec()[source]

Returns this attribute configuration’s spec.

Returns

The spec of this attribute configuration.

Return type

AttributeConfigurationSpec

delete()

Deletes this resource. Some resources do not support deletion, and will raise a 405 error if this is called.

Returns

HTTP response from the server

Return type

requests.Response

property resource_id
Type

str

Attribute Configuration Spec

class tamr_unify_client.project.attribute_configuration.resource.AttributeConfigurationSpec(client, data, api_path)[source]

A representation of the server view of an attribute configuration.

static of(resource)[source]

Creates an attribute configuration spec from an attribute configuration.

Parameters

resource (AttributeConfiguration) – The existing attribute configuration.

Returns

The corresponding attribute creation spec.

Return type

AttributeConfigurationSpec

static new()[source]

Creates a blank spec that could be used to construct a new attribute configuration.

Returns

The empty spec.

Return type

AttributeConfigurationSpec

from_data(data)[source]

Creates a spec with the same client and API path as this one, but new data.

Parameters

data (dict) – The data for the new spec.

Returns

The new spec.

Return type

AttributeConfigurationSpec

to_dict()[source]

Returns a version of this spec that conforms to the API representation.

Returns

The spec’s dict.

Return type

dict

with_attribute_role(new_attribute_role)[source]

Creates a new spec with the same properties, updating attribute role.

Parameters

new_attribute_role (str) – The new attribute role.

Returns

A new spec.

Return type

AttributeConfigurationSpec

with_similarity_function(new_similarity_function)[source]

Creates a new spec with the same properties, updating similarity function.

Parameters

new_similarity_function (str) – The new similarity function.

Returns

A new spec.

Return type

AttributeConfigurationSpec

with_enabled_for_ml(new_enabled_for_ml)[source]

Creates a new spec with the same properties, updating enabled for ML.

Parameters

new_enabled_for_ml (bool) – Whether the builder is enabled for ML.

Returns

A new spec.

Return type

AttributeConfigurationSpec

with_tokenizer(new_tokenizer)[source]

Creates a new spec with the same properties, updating tokenizer.

Parameters

new_tokenizer (str) – The new tokenizer.

Returns

A new spec.

Return type

AttributeConfigurationSpec

with_numeric_field_resolution(new_numeric_field_resolution)[source]

Creates a new spec with the same properties, updating numeric field resolution.

Parameters

new_numeric_field_resolution (str) – The new numeric field resolution.

Returns

A new spec.

Return type

AttributeConfigurationSpec

with_attribute_name(new_attribute_name)[source]

Creates a new spec with the same properties, updating new attribute name.

Parameters

new_attribute_name (str) – The new attribute name.

Returns

A new spec.

Return type

AttributeConfigurationSpec

put()[source]

Updates the attribute configuration on the server.

Returns

The modified attribute configuration.

Return type

AttributeConfiguration

Attribute Configuration Collection

class tamr_unify_client.project.attribute_configuration.collection.AttributeConfigurationCollection(client, api_path)[source]

Collection of AttributeConfiguration

Parameters
  • client (Client) – Client for API call delegation.

  • api_path (str) – API path used to access this collection. E.g. "projects/1/attributeConfigurations"

by_resource_id(resource_id)[source]

Retrieve an attribute configuration by resource ID.

Parameters

resource_id (str) – The resource ID.

Returns

The specified attribute configuration.

Return type

AttributeConfiguration

by_relative_id(relative_id)[source]

Retrieve an attribute configuration by relative ID.

Parameters

relative_id (str) – The relative ID.

Returns

The specified attribute configuration.

Return type

AttributeConfiguration

by_external_id(external_id)[source]

Retrieve an attribute configuration by external ID.

Since attributes do not have external IDs, this method is not supported and will raise a NotImplementedError .

Parameters

external_id (str) – The external ID.

Returns

The specified attribute, if found.

Return type

AttributeConfiguration

Raises
  • KeyError – If no attribute with the specified external_id is found

  • LookupError – If multiple attributes with the specified external_id are found

  • NotImplementedError – AttributeConfiguration does not support external_id

stream()[source]

Stream attribute configurations in this collection. Implicitly called when iterating over this collection.

Returns

Stream of attribute configurations.

Return type

Python generator yielding AttributeConfiguration

Usage:
>>> for attributeConfiguration in collection.stream(): # explicit
>>>     do_stuff(attributeConfiguration)
>>> for attributeConfiguration in collection: # implicit
>>>     do_stuff(attributeConfiguration)
create(creation_spec)[source]

Create an Attribute configuration in this collection

Parameters

creation_spec (dict[str, str]) – Attribute configuration creation specification should be formatted as specified in the Public Docs for adding an AttributeConfiguration.

Returns

The created Attribute configuration

Return type

AttributeConfiguration

delete_by_resource_id(resource_id)

Deletes a resource from this collection by resource ID.

Parameters

resource_id (str) – The resource ID of the resource that will be deleted.

Returns

HTTP response from the server.

Return type

requests.Response

Attribute Mappings

Attribute Mapping

class tamr_unify_client.project.attribute_mapping.resource.AttributeMapping(client, data)[source]

see https://docs.tamr.com/reference#retrieve-projects-mappings AttributeMapping and AttributeMappingCollection do not inherit from BaseResource and BaseCollection. BC and BR require a specific URL for each individual attribute mapping (ex: /projects/1/attributeMappings/1), but these types of URLs do not exist for attribute mappings

property id
Type

str

property relative_id
Type

str

property input_attribute_id
Type

str

property relative_input_attribute_id
Type

str

property input_dataset_name
Type

str

property input_attribute_name
Type

str

property unified_attribute_id
Type

str

property relative_unified_attribute_id
Type

str

property unified_dataset_name
Type

str

property unified_attribute_name
Type

str

property resource_id
Type

str

spec()[source]

Returns a spec representation of this attribute mapping.

Returns

The attribute mapping spec.

Return type

AttributeMappingSpec

delete()[source]

Delete this attribute mapping.

Returns

HTTP response from the server

Return type

requests.Response

Attribute Mapping Spec

class tamr_unify_client.project.attribute_mapping.resource.AttributeMappingSpec(data)[source]

A representation of the server view of an attribute mapping

static of(resource)[source]

Creates an attribute mapping spec from a attribute mapping.

Parameters

resource (AttributeMapping) – The existing attribute mapping.

Returns

The corresponding attribute mapping spec.

Return type

AttributeMappingSpec

static new()[source]

Creates a blank spec that could be used to construct a new attribute mapping.

Returns

The empty spec.

Return type

AttributeMappingSpec

to_dict()[source]

Returns a version of this spec that conforms to the API representation.

Returns

The spec’s dict.

Return type

dict

with_input_attribute_id(new_input_attribute_id)[source]

Creates a new spec with the same properties, updating the input attribute id.

Parameters

new_input_attribute_id (str) – The new input attribute id.

Returns

The new spec.

Return type

AttributeMappingSpec

with_relative_input_attribute_id(new_relative_input_attribute_id)[source]

Creates a new spec with the same properties, updating the relative input attribute id.

Parameters

new_relative_input_attribute_id (str) – The new relative input attribute Id.

Returns

The new spec.

Return type

AttributeMappingSpec

with_input_dataset_name(new_input_dataset_name)[source]

Creates a new spec with the same properties, updating the input dataset name.

Parameters

new_input_dataset_name (str) – The new input dataset name.

Returns

The new spec.

Return type

AttributeMappingSpec

with_input_attribute_name(new_input_attribute_name)[source]

Creates a new spec with the same properties, updating the input attribute name.

Parameters

new_input_attribute_name (str) – The new input attribute name.

Returns

The new spec.

Return type

AttributeMappingSpec

with_unified_attribute_id(new_unified_attribute_id)[source]

Creates a new spec with the same properties, updating the unified attribute id.

Parameters

new_unified_attribute_id (str) – The new unified attribute id.

Returns

The new spec.

Return type

AttributeMappingSpec

with_relative_unified_attribute_id(new_relative_unified_attribute_id)[source]

Creates a new spec with the same properties, updating the relative unified attribute id.

Parameters

new_relative_unified_attribute_id (str) – The new relative unified attribute id.

Returns

The new spec.

Return type

AttributeMappingSpec

with_unified_dataset_name(new_unified_dataset_name)[source]

Creates a new spec with the same properties, updating the unified dataset name.

Parameters

new_unified_dataset_name (str) – The new unified dataset name.

Returns

The new spec.

Return type

AttributeMappingSpec

with_unified_attribute_name(new_unified_attribute_name)[source]

Creates a new spec with the same properties, updating the unified attribute name.

Parameters

new_unified_attribute_name (str) – The new unified attribute name.

Returns

The new spec.

Return type

AttributeMappingSpec

Attribute Mapping Collection

class tamr_unify_client.project.attribute_mapping.collection.AttributeMappingCollection(client, api_path)[source]

Collection of AttributeMapping

Parameters
  • client (Client) – Client for API call delegation.

  • api_path (str) – API path used to access this collection.

stream()[source]

Stream attribute mappings in this collection. Implicitly called when iterating over this collection.

Returns

Stream of attribute mappings.

Return type

Python generator yielding AttributeMapping

by_resource_id(resource_id)[source]

Retrieve an item in this collection by resource ID.

Parameters

resource_id (str) – The resource ID.

Returns

The specified attribute mapping.

Return type

AttributeMapping

by_relative_id(relative_id)[source]

Retrieve an item in this collection by relative ID.

Parameters

relative_id (str) – The relative ID.

Returns

The specified attribute mapping.

Return type

AttributeMapping

create(creation_spec)[source]

Create an Attribute mapping in this collection

Parameters

creation_spec (dict[str, str]) – Attribute mapping creation specification should be formatted as specified in the Public Docs for adding an AttributeMapping.

Returns

The created Attribute mapping

Return type

AttributeMapping

delete_by_resource_id(resource_id)[source]

Delete an attribute mapping using its Resource ID.

Parameters

resource_id (str) – the resource ID of the mapping to be deleted.

Returns

HTTP response from the server

Return type

requests.Response

Project

class tamr_unify_client.project.resource.Project(client, data, alias=None)[source]

A Tamr project.

property name
Type

str

property external_id
Type

str

property description
Type

str

property type

A Tamr project type, listed in https://docs.tamr.com/reference#create-a-project.

Type

str

property attributes

Attributes of this project.

Returns

Attributes of this project.

Return type

AttributeCollection

unified_dataset()[source]

Unified dataset for this project.

Returns

Unified dataset for this project.

Return type

Dataset

as_categorization()[source]

Convert this project to a CategorizationProject

Returns

This project.

Return type

CategorizationProject

Raises

TypeError – If the type of this project is not "CATEGORIZATION"

as_mastering()[source]

Convert this project to a MasteringProject

Returns

This project.

Return type

MasteringProject

Raises

TypeError – If the type of this project is not "DEDUP"

add_input_dataset(dataset)[source]

Associate a dataset with a project in Tamr.

By default, datasets are not associated with any projects. They need to be added as input to a project before they can be used as part of that project

Parameters

dataset (Dataset) – The dataset to associate with the project.

Returns

HTTP response from the server

Return type

requests.Response

remove_input_dataset(dataset)[source]

Remove a dataset from a project.

Parameters

dataset (Dataset) – The dataset to be removed from this project.

Returns

HTTP response from the server

Return type

requests.Response

input_datasets()[source]

Retrieve a collection of this project’s input datasets.

Returns

The project’s input datasets.

Return type

DatasetCollection

attribute_configurations()[source]

Project’s attribute’s configurations.

Returns

The configurations of the attributes of a project.

Return type

AttributeConfigurationCollection

attribute_mappings()[source]

Project’s attribute’s mappings.

Returns

The attribute mappings of a project.

Return type

AttributeMappingCollection

spec()[source]

Returns this project’s spec.

Returns

The spec for the project.

Return type

ProjectSpec

delete()

Deletes this resource. Some resources do not support deletion, and will raise a 405 error if this is called.

Returns

HTTP response from the server

Return type

requests.Response

property relative_id
Type

str

property resource_id
Type

str

Project Spec

class tamr_unify_client.project.resource.ProjectSpec(client, data, api_path)[source]

A representation of the server view of a project.

static of(resource)[source]

Creates a project spec from a project.

Parameters

resource (Project) – The existing project.

Returns

The corresponding project spec.

Return type

ProjectSpec

static new()[source]

Creates a blank spec that could be used to construct a new project.

Returns

The empty spec.

Return type

ProjectSpec

from_data(data)[source]

Creates a spec with the same client and API path as this one, but new data.

Parameters

data (dict) – The data for the new spec.

Returns

The new spec.

Return type

ProjectSpec

to_dict()[source]

Returns a version of this spec that conforms to the API representation.

Returns

The spec’s dict.

Return type

dict

with_name(new_name)[source]

Creates a new spec with the same properties, updating name.

Parameters

new_name (str) – The new name.

Returns

The new spec.

Return type

ProjectSpec

with_description(new_description)[source]

Creates a new spec with the same properties, updating description.

Parameters

new_description (str) – The new description.

Returns

The new spec.

Return type

ProjectSpec

with_type(new_type)[source]

Creates a new spec with the same properties, updating type.

Parameters

new_type (str) – The new type.

Returns

The new spec.

Return type

ProjectSpec

with_external_id(new_external_id)[source]

Creates a new spec with the same properties, updating external ID.

Parameters

new_external_id (str) – The new external ID.

Returns

The new spec.

Return type

ProjectSpec

with_unified_dataset_name(new_unified_dataset_name)[source]

Creates a new spec with the same properties, updating unified dataset name.

Parameters

new_unified_dataset_name (str) – The new unified dataset name.

Returns

The new spec.

Return type

ProjectSpec

put()[source]

Commits these changes by updating the project in Tamr.

Returns

The updated project.

Return type

Project

Project Collection

class tamr_unify_client.project.collection.ProjectCollection(client, api_path='projects')[source]

Collection of Project s.

Parameters
  • client (Client) – Client for API call delegation.

  • api_path (str) – API path used to access this collection. Default: "projects".

by_resource_id(resource_id)[source]

Retrieve a project by resource ID.

Parameters

resource_id (str) – The resource ID. E.g. "1"

Returns

The specified project.

Return type

Project

by_relative_id(relative_id)[source]

Retrieve a project by relative ID.

Parameters

relative_id (str) – The resource ID. E.g. "projects/1"

Returns

The specified project.

Return type

Project

by_external_id(external_id)[source]

Retrieve a project by external ID.

Parameters

external_id (str) – The external ID.

Returns

The specified project, if found.

Return type

Project

Raises
  • KeyError – If no project with the specified external_id is found

  • LookupError – If multiple projects with the specified external_id are found

stream()[source]

Stream projects in this collection. Implicitly called when iterating over this collection.

Returns

Stream of projects.

Return type

Python generator yielding Project

Usage:
>>> for project in collection.stream(): # explicit
>>>     do_stuff(project)
>>> for project in collection: # implicit
>>>     do_stuff(project)
by_name(project_name)[source]

Get project by name

Fetches a specific project in this collection by exact-match on name.

Parameters

project_name (str) – Name of the desired project.

Raises

KeyError – If no project with specified name was found.

Return type

Project

create(creation_spec)[source]

Create a Project in Tamr

Parameters

creation_spec (dict[str, str]) – Project creation specification should be formatted as specified in the Public Docs for Creating a Project.

Returns

The created Project

Return type

Project

delete_by_resource_id(resource_id)

Deletes a resource from this collection by resource ID.

Parameters

resource_id (str) – The resource ID of the resource that will be deleted.

Returns

HTTP response from the server.

Return type

requests.Response

Project Step

class tamr_unify_client.project.step.ProjectStep(client, data)[source]

A step of a Tamr project. This is not a BaseResource because it has no API path and cannot be directly retrieved or modified.

See https://docs.tamr.com/reference#retrieve-downstream-dataset-usage

Parameters
  • client (Client) – Delegate underlying API calls to this client.

  • data (dict) – The JSON body containing project step information.

property project_step_id
Type

str

property project_step_name
Type

str

property project_name
Type

str

property type

A Tamr project type, listed in https://docs.tamr.com/reference#create-a-project.

Type

str

project()[source]

Retrieves the Project this step is associated with.

Returns

This step’s project.

Return type

Project

Raises
  • KeyError – If no project with the specified name is found.

  • LookupError – If multiple projects with the specified name are found.