I'm using redshift_connector to connect with the AWS Redshift database as documented by AWS.
In particular, I'm using the write_dataframe function to integrate with Pandas.
Example code:
...
connection_info = get_database_info()
conn = redshift_connector.connect(**connection_info)
cursor = conn.cursor()
...
df = ...
...
cursor.write_dataframe(df, "test_schema.test_table")
Where the test_table
table was just created in order to test this function. The problem I'm facing is that the code stucks in the debugger without finishing when calling the function, underhood, the code blocks on the executemany
calls on the cursor.
I'm using:
- Python 3.9.20
- pandas>=2.2.3
- redshift-connector>=2.1.5
What can I do to debug further and get to know what is the problem? The dataframe is small (like 270 rows and 40 columns). I already face another problem that was:
the cursor used on the write_dataframe
function seems to overwrite the cursor params style and uses internally only position based formatting like insert values (%s, %s, ...)
so I had to reorder the pandas DataFrame columns based on the same order of the Redshift table columns.