feat(ingest): add dataproduct_mapping_based_on_tags transformer

Merged
AC
2d ago
+307-2

Summary

  • Adds dataproduct_mapping_based_on_tags, mirroring domain_mapping_based_on_tags, so datasets can be assigned to data products from tags already present in DataHub.
  • Reads tags via the graph (get_tags), maps the first matching simple tag name to a data product URN, and patches the product assets through the existing AddDatasetDataProduct path.
  • Documents the transformer and covers match / no-match / config-order / empty / missing-tag cases in unit tests.

Test plan

  • pytest -vv tests/unit/test_transform_dataset.py -k 'dataproduct_mapping_based_on_tags'
  • ./gradlew :metadata-ingestion:lintFix :metadata-ingestion:checkLockFile
  • Confirm recipe usage with a datahub-rest sink against a local DataHub that already has the mapped tags on datasets

Summary by cubic

Adds a dataproduct_mapping_based_on_tags transformer that assigns datasets to data products based on tags already present in DataHub, mirroring the existing domain_mapping_based_on_tags.

  • Reads tags from the graph via get_tags and raises a ConfigurationError when no graph connection is configured.
  • When several mapped tags match, the tag listed first in dataproduct_mapping decides the data product, regardless of the dataset's tag order.
  • Adds the dataset as an asset via the existing AddDatasetDataProduct path using a patch, so current data product memberships are preserved.
  • Documents that tags must already be in DataHub before the run and that removing a tag does not remove the dataset from its data product.
  • Registers the transformer entry point and adds unit tests covering match, no-match, config-order-wins, empty-tags, missing-tags, and no-graph cases.