From f39ed5244cbad2c6b022169cbbb04424b7e13d7d Mon Sep 17 00:00:00 2001 From: Harshal Sheth Date: Wed, 18 Jan 2023 01:42:08 -0800 Subject: [PATCH] fix(ingest): support multiple entity_registry sections (#7066) --- metadata-ingestion/scripts/avro_codegen.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/metadata-ingestion/scripts/avro_codegen.py b/metadata-ingestion/scripts/avro_codegen.py index 59db910050..296f81fd79 100644 --- a/metadata-ingestion/scripts/avro_codegen.py +++ b/metadata-ingestion/scripts/avro_codegen.py @@ -272,7 +272,13 @@ def generate(entity_registry: str, schemas_path: str, outdir: str) -> None: aspect = aspects[entity.keyAspect] # This requires that entities cannot share a keyAspect. - assert "keyForEntity" not in aspect["Aspect"] + if ( + "keyForEntity" in aspect["Aspect"] + and aspect["Aspect"]["keyForEntity"] != entity.name + ): + raise ValueError( + f'Entity key {entity.keyAspect} is used by {aspect["Aspect"]["keyForEntity"]} and {entity.name}' + ) aspect["Aspect"]["keyForEntity"] = entity.name aspect["Aspect"]["entityCategory"] = entity.category