From fee567d714d6403b9af2e4b45118a1d648a14bb3 Mon Sep 17 00:00:00 2001 From: Mayur Singal <39544459+ulixius9@users.noreply.github.com> Date: Thu, 20 Jul 2023 13:18:18 +0530 Subject: [PATCH] Fix #12301: Fix vertica col comments for projections with the same name (#12504) --- .../metadata/ingestion/source/database/vertica/metadata.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ingestion/src/metadata/ingestion/source/database/vertica/metadata.py b/ingestion/src/metadata/ingestion/source/database/vertica/metadata.py index c3f03044176..d1bcc4755f1 100644 --- a/ingestion/src/metadata/ingestion/source/database/vertica/metadata.py +++ b/ingestion/src/metadata/ingestion/source/database/vertica/metadata.py @@ -90,7 +90,7 @@ def get_columns( ) pk_columns = [x[0] for x in connection.execute(spk)] - columns = [] + columns = {} for row in connection.execute(sql_query): name = row.column_name dtype = row.data_type.lower() @@ -108,8 +108,9 @@ def get_columns( comment, ) column_info.update({"primary_key": primary_key}) - columns.append(column_info) - return columns + if columns.get(name) is None or comment: + columns[name] = column_info + return columns.values() def _get_column_info( # pylint: disable=too-many-locals,too-many-branches,too-many-statements