feat(ingest): add dataproduct_mapping_based_on_tags transformer
Merged
AC
2d ago+307+307+012345678901234567890123456789-2-2-0123456789
Summary
- Adds
dataproduct_mapping_based_on_tags, mirroringdomain_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 existingAddDatasetDataProductpath. - 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-restsink 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_tagsand raises aConfigurationErrorwhen no graph connection is configured. - When several mapped tags match, the tag listed first in
dataproduct_mappingdecides the data product, regardless of the dataset's tag order. - Adds the dataset as an asset via the existing
AddDatasetDataProductpath 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.