Repository navigation
fix(ingest/kafka): don't set topic external URL on Schema Registry subjects - #21849
Conversation
…bjects With ingest_schemas_as_entities enabled, every subject was given <external_url_base>/<subject>, a topic path that never exists. The URL is now built for topics only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR SummaryOverview In A unit test ( Reviewed by Cursor Bugbot for commit 553fb9f. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
Linear: ING-4516 Thanks for your contribution! We have created an internal ticket to track this PR. A member of the core DataHub team will be assigned to review it within the next few business days - you will get a follow-up comment once a reviewer is assigned. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
acrylJonny
left a comment
There was a problem hiding this comment.
Thanks for this, LGTM. The fix is right and kept small: the external_url_base block now sits inside the existing if not is_subject: guard, and is_subject is a fixed literal at both call sites, so a topic can't be mistaken for a subject. The regression test fails without the fix and can't pass by skipping the subject. Golden files are unaffected, since the integration recipe doesn't set external_url_base.
A few optional suggestions, none blocking:
kafka.py, the URL block: it's nested inside the catalog-metadata / mirror-lineage block, which has nothing to do with URLs. If someone later adds a condition to that block, every topic would silently lose its link. A flat guard reads better and makes the comment unnecessary:if not is_subject and self.source_config.external_url_base:
- Subject/topic name collision (existing behaviour, slightly extended here): a subject's
dataset_nameis its subject name. If a subject is named exactly like a topic (e.g. under a custom subject naming strategy), the two share a URN. Subjects are emitted after topics, so the subject'sDatasetPropertiesreplaces the topic's: that already overwrote subtype and custom properties, and now it also blanks the topic's URL. This is rare with the default<topic>-value/<topic>-keynaming, so not worth holding the PR for. A follow-up could skip a subject whose URN was already emitted as a topic. - Test file: a full
RegisteredSchemais now built inline twice. A small helper would tidy that up, though it isn't worth much for two uses. The Avro schema string could also be trimmed to"fields":[]. - Wording nits: the code comment could give the reason ("Schema subjects are not topics, so they have no page under
external_url_base"), and the test docstring's "would 404" isn't something the test checks. "Has no page under the topic path" is tighter.
Keep the URL check out of the catalog-metadata block so a future condition there cannot drop topic links. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@acrylJonny I have addressed the review comments. Can you please review again? |
Thank you. I can see that everything is now addressed - enabling auto-merge. |
With
ingest_schemas_as_entities: true, the Kafka source emits each Schema Registry subject as its own dataset. Theexternal_url_basehandling in_emit_datasetsat outside theif not is_subject:guard immediately above it, so every subject was given the same URL shape as a topic:A subject is not addressable under a broker's topic path, so that link 404s on every console. In the UI this showed up as a "View in Kafka" button on each subject that never worked.
Fix
Build the external URL only for topics, by moving the
external_url_baseblock inside the existingif not is_subject:guard. Subjects now carry noexternalUrl. Topic links are unchanged.The
external_url_basefield description now states that it applies to topics only.Behaviour change
Recipes that combine
ingest_schemas_as_entities: truewithexternal_url_basestop emitting anexternalUrlon subject datasets. Only a link that never resolved is removed; no recipe changes are needed. Recipes without both settings are unaffected, and the existing Kafka golden files do not change.Testing
test_external_url_base_skips_schema_subjects: one topic plus one subject with both settings enabled; the topic gets<base>/ordersand the subject gets no URL. Confirmed the test fails without the fix.tests/unit/kafka/test_kafka_source_lifecycle.py: all tests pass.orders->.../all-topics/orders,orders-value->.../all-topics/orders-value(404)orders->.../all-topics/orders,orders-value->nullChecklist
Summary by cubic
Fixes the Kafka source generating broken
externalUrllinks on Schema Registry subjects wheningest_schemas_as_entitiesis enabled. Subjects were given topic-style URLs that always 404; now only topics get an external URL.Behavior change
externalUrl, so the "View in Kafka" button no longer appears for them.external_url_baseconfig description now states it applies to topics only.Written for commit 553fb9f. Summary will update on new commits.