Attributes

Attribute

class tamr_unify_client.attribute.resource.Attribute(client, data, alias=None)[source]

A Tamr Attribute.

See https://docs.tamr.com/reference#attribute-types

property relative_id

str

Type

type

property name

str

Type

type

property description

str

Type

type

property type

AttributeType

Type

type

property is_nullable

bool

Type

type

spec()[source]

Returns a spec representation of this attribute.

Returns

The attribute spec.

Return type

AttributeSpec

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

str

Type

type

Attribute Spec

class tamr_unify_client.attribute.resource.AttributeSpec(client, data, api_path)[source]

A representation of the server view of an attribute

static of(resource)[source]

Creates an attribute spec from an attribute.

Parameters

resource (Attribute) – The existing attribute.

Returns

The corresponding attribute spec.

Return type

AttributeSpec

static new()[source]

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

Returns

The empty spec.

Return type

AttributeSpec

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

AttributeSpec

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

AttributeSpec

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

AttributeSpec

with_type(new_type)[source]

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

Parameters

new_type (AttributeTypeSpec) – The spec of the new type.

Returns

The new spec.

Return type

AttributeSpec

with_is_nullable(new_is_nullable)[source]

Creates a new spec with the same properties, updating is nullable.

Parameters

new_is_nullable (bool) – The new is nullable.

Returns

The new spec.

Return type

AttributeSpec

put()[source]

Commits the changes and updates the attribute in Tamr.

Returns

The updated attribute.

Return type

Attribute

Attribute Collection

class tamr_unify_client.attribute.collection.AttributeCollection(client, api_path)[source]

Collection of Attribute s.

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

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

by_resource_id(resource_id)[source]

Retrieve an attribute by resource ID.

Parameters

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

Returns

The specified attribute.

Return type

Attribute

by_relative_id(relative_id)[source]

Retrieve an attribute by relative ID.

Parameters

relative_id (str) – The resource ID. E.g. "datasets/1/attributes/AttributeName"

Returns

The specified attribute.

Return type

Attribute

by_external_id(external_id)[source]

Retrieve an attribute 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

Attribute

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

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

stream()[source]

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

Returns

Stream of attributes.

Return type

Python generator yielding Attribute

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

Lookup a specific attribute in this collection by exact-match on name.

Parameters

attribute_name (str) – Name of the desired attribute.

Returns

Attribute with matching name in this collection.

Return type

Attribute

create(creation_spec)[source]

Create an Attribute in this collection

Parameters

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

Returns

The created Attribute

Return type

Attribute

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 Type

class tamr_unify_client.attribute.type.AttributeType(data)[source]

The type of an Attribute or SubAttribute.

See https://docs.tamr.com/reference#attribute-types

Parameters

data (dict) – JSON data representing this type

property base_type

str

Type

type

property inner_type

AttributeType

Type

type

property attributes

list[SubAttribute]

Type

type

spec()[source]

Returns a spec representation of this attribute type.

Returns

The attribute type spec.

Return type

AttributeTypeSpec

Attribute Type Spec

class tamr_unify_client.attribute.type.AttributeTypeSpec(data)[source]
static of(resource)[source]

Creates an attribute type spec from an attribute type.

Parameters

resource (AttributeType) – The existing attribute type.

Returns

The corresponding attribute type spec.

Return type

AttributeTypeSpec

static new()[source]

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

Returns

The empty spec.

Return type

AttributeTypeSpec

to_dict()[source]

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

Returns

The spec’s dict.

Return type

dict

with_base_type(new_base_type)[source]

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

Parameters

new_base_type (str) – The new base type.

Returns

The new spec.

Return type

AttributeTypeSpec

with_inner_type(new_inner_type)[source]

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

Parameters

new_inner_type (AttributeTypeSpec) – The spec of the new inner type.

Returns

The new spec.

Return type

AttributeTypeSpec

with_attributes(new_attributes)[source]

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

Parameters

new_attributes (list[AttributeSpec]) – The specs of the new attributes.

Returns

The new spec.

Return type

AttributeTypeSpec

SubAttribute

class tamr_unify_client.attribute.subattribute.SubAttribute(name, type, is_nullable, _json, description=None)[source]

An attribute which is itself a property of another attribute.

See https://docs.tamr.com/reference#attribute-types

Parameters
static from_json(data)[source]

Create a SubAttribute from JSON data.

Parameters

data (Dict[str, Any]) – JSON data received from Tamr server.

Return type

SubAttribute