Fix #12301: Fix vertica col comments for projections with the same name (#12504)

This commit is contained in:
Mayur Singal 2023-07-20 13:18:18 +05:30 committed by GitHub
parent 3e7e71d10a
commit fee567d714
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -90,7 +90,7 @@ def get_columns(
) )
pk_columns = [x[0] for x in connection.execute(spk)] pk_columns = [x[0] for x in connection.execute(spk)]
columns = [] columns = {}
for row in connection.execute(sql_query): for row in connection.execute(sql_query):
name = row.column_name name = row.column_name
dtype = row.data_type.lower() dtype = row.data_type.lower()
@ -108,8 +108,9 @@ def get_columns(
comment, comment,
) )
column_info.update({"primary_key": primary_key}) column_info.update({"primary_key": primary_key})
columns.append(column_info) if columns.get(name) is None or comment:
return columns columns[name] = column_info
return columns.values()
def _get_column_info( # pylint: disable=too-many-locals,too-many-branches,too-many-statements def _get_column_info( # pylint: disable=too-many-locals,too-many-branches,too-many-statements