Revert "Fixes #20649: removed memory leak in Redshift ingestion (#20650)" (#20667)

This reverts commit 6c725278e3e7bd5cb5f492108fa27dc8f9487f82.
This commit is contained in:
Mohit Tilala 2025-04-07 18:16:50 +05:30 committed by GitHub
parent ee5d8eee8b
commit f7c4cc54f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)