From df6232ef5258af87a7b0caed6e5a8de6073216a7 Mon Sep 17 00:00:00 2001 From: Sriharsha Chintalapani Date: Thu, 16 Dec 2021 12:15:42 -0800 Subject: [PATCH] Fix #1808: check for None in description (#1809) --- ingestion/examples/workflows/mariadb.json | 6 +++--- ingestion/examples/workflows/redshift_dbt.json | 6 +++--- .../src/metadata/ingestion/sink/metadata_rest.py | 11 +++++++++-- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/ingestion/examples/workflows/mariadb.json b/ingestion/examples/workflows/mariadb.json index eb5d79cc397..eed941f5760 100644 --- a/ingestion/examples/workflows/mariadb.json +++ b/ingestion/examples/workflows/mariadb.json @@ -5,9 +5,9 @@ "username": "openmetadata_user", "password": "openmetadata_password", "database": "openmetadata_db", - "service_name": "local_mysql", - "filter_pattern": { - "excludes": ["mysql.*", "information_schema.*", "performance_schema.*", "sys.*"] + "service_name": "local_mariadb", + "schema_filter_pattern": { + "excludes": ["information_schema.*", "performance_schema.*", "sys.*"] } } }, diff --git a/ingestion/examples/workflows/redshift_dbt.json b/ingestion/examples/workflows/redshift_dbt.json index 969dd703872..b2038ee8229 100644 --- a/ingestion/examples/workflows/redshift_dbt.json +++ b/ingestion/examples/workflows/redshift_dbt.json @@ -2,14 +2,14 @@ "source": { "type": "redshift", "config": { - "host_port": "cluster.name.region.redshift.amazonaws.com:5439", + "host_port": "cluster.name.region.redshift.amazonaws.com:5439", "username": "username", "password": "strong_password", "database": "warehouse", "service_name": "aws_redshift", "generate_sample_data": "false", - "filter_pattern": { - "excludes": ["information_schema.*", "[\\w]*event_vw.*"] + "schema_filter_pattern": { + "excludes": ["information_schema.*"] }, "dbt_manifest_file": "./examples/sample_data/dbt/manifest.json", "dbt_catalog_file": "./examples/sample_data/dbt/catalog.json" diff --git a/ingestion/src/metadata/ingestion/sink/metadata_rest.py b/ingestion/src/metadata/ingestion/sink/metadata_rest.py index 6059d21a7c2..d3eb97cea69 100644 --- a/ingestion/src/metadata/ingestion/sink/metadata_rest.py +++ b/ingestion/src/metadata/ingestion/sink/metadata_rest.py @@ -145,11 +145,14 @@ class MetadataRestSink(Sink[Entity]): ), ) db = self.metadata.create_or_update(db_request) + if db_and_table.table.description is not None: + db_and_table.table.description = db_and_table.table.description.strip() + table_request = CreateTableEntityRequest( name=db_and_table.table.name, tableType=db_and_table.table.tableType, columns=db_and_table.table.columns, - description=db_and_table.table.description.strip(), + description=db_and_table.table.description, database=db.id, ) if db_and_table.table.viewDefinition: @@ -159,9 +162,13 @@ class MetadataRestSink(Sink[Entity]): created_table = self.metadata.create_or_update(table_request) if db_and_table.location is not None: + if db_and_table.location.description is not None: + db_and_table.location.description = ( + db_and_table.location.description.strip() + ) location_request = CreateLocationEntityRequest( name=db_and_table.location.name, - description=db_and_table.location.description.strip(), + description=db_and_table.location.description, locationType=db_and_table.location.locationType, owner=db_and_table.location.owner, service=EntityReference(