Repository navigation
feat(ingest): add dataproduct_mapping_based_on_tags transformer - #21640
Conversation
Mirror domain_mapping_based_on_tags so datasets can be assigned to data products from tags already present in DataHub. Co-authored-by: Cursor <cursoragent@cursor.com>
PR SummaryOverview The new The transformer is registered in Reviewed by Cursor Bugbot for commit 54f7a85. Bugbot is set up for automated code reviews on this repo. Configure here. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Smart test selectionpytest smoke testsMode: shadow. The selection below is computed but not applied; this PR still runs the default matrix (
Selected scopes (11 files or classes, 44 tests)
Add the commit |
Connector Tests ResultsAll connector tests passed for commit To skip connector tests, add the Autogenerated by the connector-tests CI pipeline. |
max-datahub
left a comment
There was a problem hiding this comment.
Approving — small, opt-in, additive, and it reuses the tested AddDatasetDataProduct patch path. A few non-blocking notes:
- First-matching-tag wins.
multipleDataProductsPerAssetdefaults totrueon the server, so a dataset tagged with two mapped tags could legitimately belong to both products, but only one is added (chosen by tag order on the dataset, not config order). The siblingdomain_mapping_based_on_tagsadds every matched domain. Was first-wins intentional? Switching to "add to all matched products" later would be additive, so this doesn't need to block. - Fail fast without a graph.
assert ctx.graphlives inside the callback, so a recipe without a graph connection only fails at end-of-stream, after the whole source has run, with a bareAssertionError. Checking in__init__/createand raising aConfigurationError(likeAddDomain.raise_ctx_configuration_error) would surface it immediately. Fine as a follow-up. - Docs.
- Tags are read from GMS before the sink is flushed, and tags in the current run's stream aren't consulted. So tags the source emits in the same run (e.g. platform tag extraction) only take effect on the next run. Worth saying "tags must already exist in DataHub before the run".
- Removing a tag doesn't remove the dataset from the data product (additive only).
- "Datasets already in a data product stay in it" holds only when
multipleDataProductsPerAssetis enabled (the default). - Minor: the two paragraphs between "would look like this:" and the YAML block read better after it.
Also, the test plan's live datahub-rest check is still unticked. Was it run? The unit tests stub get_tags.
- Claude (on behalf of Max)
… a graph - When a dataset has several mapped tags, the tag listed first in dataproduct_mapping now decides its data product, rather than the order of the dataset's tags. - Raise a ConfigurationError when the transformer is created without a DataHub graph, instead of an AssertionError at the end of the stream. - Document that tags must already be in DataHub before the run, that removing a tag does not remove the dataset from the data product, and when existing memberships are kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks. All points are addressed in 54f7a85.
Live check, now ticked: I ran it with a
The 6 transformer unit tests pass. ruff, mypy and markdown prettier are clean.
|
Summary
dataproduct_mapping_based_on_tags, mirroringdomain_mapping_based_on_tags, so datasets can be assigned to data products from tags already present in DataHub.get_tags), maps the first matching simple tag name to a data product URN, and patches the product assets through the existingAddDatasetDataProductpath.Test plan
pytest -vv tests/unit/test_transform_dataset.py -k 'dataproduct_mapping_based_on_tags'./gradlew :metadata-ingestion:lintFix :metadata-ingestion:checkLockFiledatahub-restsink against a local DataHub that already has the mapped tags on datasetsSummary by cubic
Adds a
dataproduct_mapping_based_on_tagstransformer that assigns datasets to data products based on tags already present in DataHub, mirroring the existingdomain_mapping_based_on_tags.get_tagsand raises aConfigurationErrorwhen no graph connection is configured.dataproduct_mappingdecides the data product, regardless of the dataset's tag order.AddDatasetDataProductpath using a patch, so current data product memberships are preserved.Written for commit 54f7a85. Summary will update on new commits.