diff --git a/metadata-ingestion/src/datahub/ingestion/extractor/schema_util.py b/metadata-ingestion/src/datahub/ingestion/extractor/schema_util.py index 094181c729..fcbd12e6af 100644 --- a/metadata-ingestion/src/datahub/ingestion/extractor/schema_util.py +++ b/metadata-ingestion/src/datahub/ingestion/extractor/schema_util.py @@ -440,8 +440,14 @@ def avro_schema_to_mce_fields( :param is_key_schema: True if it is a key-schema. Default is False (value-schema). :return: The list of MCE compatible SchemaFields. """ - return list( - AvroToMceSchemaConverter.to_mce_fields( - avro_schema_string, is_key_schema, default_nullable + schema_fields: List[SchemaField] = [] + try: + schema_fields = list( + AvroToMceSchemaConverter.to_mce_fields( + avro_schema_string, is_key_schema, default_nullable + ) ) - ) + except Exception: + logger.exception(f"Failed to parse {avro_schema_string} to mce_fields.") + + return schema_fields diff --git a/metadata-ingestion/tests/unit/test_schema_util.py b/metadata-ingestion/tests/unit/test_schema_util.py index cb2a2516f6..45ee02f776 100644 --- a/metadata-ingestion/tests/unit/test_schema_util.py +++ b/metadata-ingestion/tests/unit/test_schema_util.py @@ -642,3 +642,19 @@ def test_key_schema_handling(): assret_field_paths_match(fields, expected_field_paths) for f in fields: assert f.isPartOfKey + + +def test_ignore_exceptions(): + schema: str = """ +["string", +{ + "name": "event_ts", + "type": "long", + "logicalType": "timestamp-millis", + "tags": [ + "business-timestamp" + ] +}] + """ + fields: List[SchemaField] = avro_schema_to_mce_fields(schema, is_key_schema=False) + assert not fields