Common¶
Movement¶
Tasks related to project movement as part of Tamr projects
- tamr_toolbox.project._common.movement.export_artifacts(*, project, artifact_directory_path, exclude_artifacts=None, asynchronous=False)[source]¶
Export project artifacts for project movement
Requires Tamr 2021.005.0 or later
- Parameters
- Return type
- Returns
operation for project export api call
- tamr_toolbox.project._common.movement.import_artifacts(*, project_artifact_path, tamr_client, target_project=None, new_project_name=None, new_unified_dataset_name=None, exclude_artifacts=None, include_additive_artifacts=None, include_destructive_artifacts=None, fail_if_not_present=False, asynchronous=False, overwrite_existing=False)[source]¶
Import project artifacts into a tamr instance
Requires Tamr 2021.005.0 or later
- Parameters
tamr_client (
Client
) – a tamr clientproject_artifact_path (
str
) – project artifacts zip filepathtarget_project (
Optional
[Project
]) – an optional target project for migrationnew_unified_dataset_name (
Optional
[str
]) – new unified dataset nameexclude_artifacts (
Optional
[List
[str
]]) – list of artifacts to exclude in importinclude_additive_artifacts (
Optional
[List
[str
]]) – list of artifacts to import only additivelyinclude_destructive_artifacts (
Optional
[List
[str
]]) – list of artifacts to import destructivelyfail_if_not_present (
bool
) – flag to fail project if not already present in instanceasynchronous (
bool
) – flag to run function asynchronouslyoverwrite_existing (
bool
) – flag to overwrite existing project artifacts
- Return type
- Returns
operation for project import api call
Transformations¶
Tasks related to transformations with Tamr projects
- class tamr_toolbox.project._common.transformations.InputTransformation(transformation, datasets=<factory>)[source]¶
A transformation scoped to input datasets
- Version:
Requires Tamr 2020.009.0 or later
- class tamr_toolbox.project._common.transformations.TransformationGroup(input_scope=<factory>, unified_scope=<factory>)[source]¶
A group of input transformations and unified transformations
- Version:
Requires Tamr 2020.009.0 or later
- Parameters
input_scope (
List
[InputTransformation
]) – A list of transformation to apply to input datasetsunified_scope (
List
[str
]) – A list of transformation scripts to apply to the unified dataset
- tamr_toolbox.project._common.transformations.get_all(project)[source]¶
Get the transformations of a Project
- Version:
Requires Tamr 2020.009.0 or later
- Parameters
project (
Project
) – Project containing transformations- Return type
- Returns
All input transformations and unified transformations of a project
- tamr_toolbox.project._common.transformations.set_all(project, tx, *, allow_overwrite=True)[source]¶
Set the transformations of a Project
- Version:
Requires Tamr 2020.009.0 or later
- Parameters
project (
Project
) – Project to place transformations withintx (
TransformationGroup
) – Transformations to put into projectallow_overwrite – Whether existing transformations can be overwritten
- Return type
- Returns
Response object created when transformations of a project are replaced
- Raises
RuntimeError – if allow_overwrite is set to False but transformations already exists in project
ValueError – if provided tx are invalid
- tamr_toolbox.project._common.transformations.get_all_unified(project)[source]¶
Get the unified transformations of a Project
- Version:
Requires Tamr 2020.009.0 or later
- tamr_toolbox.project._common.transformations.set_all_unified(project, tx, *, allow_overwrite=True)[source]¶
Set the unified transformations of a Project. Any input transformations will not be altered
- Version:
Requires Tamr 2020.009.0 or later
- Parameters
- Return type
- Returns
Response object created when transformations of a project are replaced
- Raises
RuntimeError – if allow_overwrite is set to False but transformations already exists in project
Schema¶
Tasks related to schema mapping as part of Tamr projects
- tamr_toolbox.project._common.schema.map_attribute(project, *, source_attribute_name, source_dataset_name, unified_attribute_name)[source]¶
Maps source_attribute in source_dataset to unified_attribute in unified_dataset. If the mapping already exists it will log a warning and return the existing AttributeMapping from the project’s collection.
- Parameters
- Return type
- Returns
The created AttributeMapping
- Raises
ValueError – if input variables source_attribute_name or source_dataset_name or unified_attribute_name are set to empty strings; or if the dataset source_dataset_name is not found on Tamr; or if source_attribute_name is missing from the attributes of source_attribute_name
- tamr_toolbox.project._common.schema.unmap_attribute(project, *, source_attribute_name, source_dataset_name, unified_attribute_name)[source]¶
Unmaps a source attribute.
- Parameters
source_attribute_name (
str
) – the name of the source attribute to unmapsource_dataset_name (
str
) – the name of the source dataset containing that source attributeunified_attribute_name (
str
) – the unified attribute from which to unmapproject (
Project
) – the project in which to unmap the attribute
- Return type
- Returns
None
- tamr_toolbox.project._common.schema.bootstrap_dataset(project, *, source_dataset, force_add_dataset_to_project=False)[source]¶
Bootstraps a dataset (i.e. maps all source columns to themselves)
- Parameters
- Return type
- Returns
List of the AttributeMappings generated
- Raises
RuntimeError – if source_dataset is not part of the given project, set ‘force_add_dataset_to_project’ flag to True to automatically add it
- tamr_toolbox.project._common.schema.unmap_dataset(project, *, source_dataset, remove_dataset_from_project=False, skip_if_missing=False)[source]¶
Wholly unmaps a dataset and optionally removes it from a project.
- Parameters
source_dataset (
Dataset
) – the source dataset (Dataset object not a string) to unmapproject (
Project
) – the project in which to unmap the datasetremove_dataset_from_project (
bool
) – boolean to also remove the dataset from the projectskip_if_missing (
bool
) – boolean to skip if dataset is not in project. If set to false and dataset is not in project will raise a RuntimeError
- Return type
- Returns
None
- Raises
RuntimeError – if source_dataset is not in project and skip_if_missing not set to True