Skip to content

Commit

Permalink
fix(ingest/pulsar): handle Avro schema with missing namespace or name (
Browse files Browse the repository at this point in the history
…datahub-project#12058)

Co-authored-by: Alice <[email protected]>
Co-authored-by: Shirshanka Das <[email protected]>
Co-authored-by: Sergio Gómez Villamor <[email protected]>
Co-authored-by: Harshal Sheth <[email protected]>
  • Loading branch information
5 people authored Dec 18, 2024
1 parent 8264376 commit 5946558
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion metadata-ingestion/src/datahub/ingestion/source/pulsar.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,16 @@ def __init__(self, schema):
logger.error(f"Invalid JSON schema: {schema_data}. Error: {str(e)}")
avro_schema = {}

self.schema_name = avro_schema.get("namespace") + "." + avro_schema.get("name")
self.schema_name = "null"
if avro_schema.get("namespace") and avro_schema.get("name"):
self.schema_name = (
avro_schema.get("namespace") + "." + avro_schema.get("name")
)
elif avro_schema.get("namespace"):
self.schema_name = avro_schema.get("namespace")
elif avro_schema.get("name"):
self.schema_name = avro_schema.get("name")

self.schema_description = avro_schema.get("doc")
self.schema_type = schema.get("type")
self.schema_str = schema.get("data")
Expand Down

0 comments on commit 5946558

Please sign in to comment.