fix(ingest): support multiple entity_registry sections (#7066)

This commit is contained in:
Harshal Sheth 2023-01-18 01:42:08 -08:00 committed by GitHub
parent a3f4c40422
commit f39ed5244c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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