def manual_labels(session: Session, instance: Instance, project: CategorizationProject) -> Dataset: """Get manual labels from a Categorization project. Args: instance: Tamr instance containing project project: Tamr project containing labels Returns: Dataset containing manual labels Raises: _dataset.NotFound: If no dataset could be found at the specified URL Ambiguous: If multiple targets match dataset name """ unified_dataset = unified.from_project(session=session, instance=instance, project=project) labels_dataset_name = unified_dataset.name + "_manual_categorizations" datasets_url = URL(instance=instance, path="datasets") r = session.get(url=str(datasets_url), params={"filter": f"name=={labels_dataset_name}"}) matches = r.json() if len(matches) == 0: raise _dataset.NotFound(str(r.url)) if len(matches) > 1: raise _dataset.Ambiguous(str(r.url)) dataset_path = matches[0]["relativeId"] dataset_url = URL(instance=instance, path=dataset_path) return _dataset._from_url(session=session, url=dataset_url)
def update_unified_dataset(session: Session, project: MasteringProject) -> Operation: """Applies changes to the unified dataset and waits for the operation to complete Args: project: Tamr Mastering project """ unified_dataset = unified.from_project(session, project.url.instance, project) return unified.apply_changes(session, unified_dataset)
def update_unified_dataset(session: Session, project: MasteringProject) -> Operation: """Apply changes to the unified dataset and wait for the operation to complete Args: project: Tamr Mastering project """ unified_dataset = unified.from_project(session, project) op = unified._apply_changes_async(session, unified_dataset) return operation.wait(session, op)
def manual_labels(session: Session, project: CategorizationProject) -> Dataset: """Get manual labels from a Categorization project. Args: project: Tamr project containing labels Returns: Dataset containing manual labels Raises: dataset.NotFound: If no dataset could be found at the specified URL dataset.Ambiguous: If multiple targets match dataset name """ unified_dataset = unified.from_project(session=session, project=project) labels_dataset_name = unified_dataset.name + "_manual_categorizations" return _dataset.by_name( session=session, instance=project.url.instance, name=labels_dataset_name )
def _update_unified_dataset_async( session: Session, project: MasteringProject ) -> Operation: unified_dataset = unified.from_project(session, project) return unified._apply_changes_async(session, unified_dataset)