From f7c4cc54f4ebf120a2fb673370c880e077f7fa22 Mon Sep 17 00:00:00 2001 From: Mohit Tilala <63147650+mohittilala@users.noreply.github.com> Date: Mon, 7 Apr 2025 18:16:50 +0530 Subject: [PATCH] Revert "Fixes #20649: removed memory leak in Redshift ingestion (#20650)" (#20667) This reverts commit 6c725278e3e7bd5cb5f492108fa27dc8f9487f82. --- .../ingestion/source/database/redshift/utils.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ingestion/src/metadata/ingestion/source/database/redshift/utils.py b/ingestion/src/metadata/ingestion/source/database/redshift/utils.py index 7aba894bcf3..c2bf9a8be3a 100644 --- a/ingestion/src/metadata/ingestion/source/database/redshift/utils.py +++ b/ingestion/src/metadata/ingestion/source/database/redshift/utils.py @@ -138,13 +138,12 @@ def _get_schema_column_info( """ schema_clause = f"AND schema = '{schema if schema else ''}'" all_columns = defaultdict(list) - # Ensure the result proxy is closed after using it - with connection.execute( + result = connection.execute( REDSHIFT_GET_SCHEMA_COLUMN_INFO.format(schema_clause=schema_clause) - ) as result: - for col in result.fetchall(): - key = RelationKey(col.table_name, col.schema, connection) - all_columns[key].append(col) + ) + for col in result: + key = RelationKey(col.table_name, col.schema, connection) + all_columns[key].append(col) return dict(all_columns)