amazon-redshift-python-driver icon indicating copy to clipboard operation
amazon-redshift-python-driver copied to clipboard

write_dataframe() does not finish

Open LuchiLucs opened this issue 11 months ago • 2 comments

I'm trying to write a pandas.DataFrame into a table using the write_dataframe function but I tried waiting 10 minutes, and it does not finish.

I limited the size of the dataframe to have around 70 rows and 40 columns, the problem persists.

In the debugger, the code is stuck when calling the libray code self.executemany(sql, arrays) into write_dataframe .

How can I know what is the problem? I can read successfully another table. The table where I want to write was just created for testing purpouses.

Thanks

LuchiLucs avatar Feb 03 '25 16:02 LuchiLucs

Trying more I faced 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.

I'm using:

  1. Python 3.9.20
  2. pandas>=2.2.3
  3. redshift-connector>=2.1.5

LuchiLucs avatar Feb 04 '25 11:02 LuchiLucs

Pinning pandas < 2.0, numpy < 2.0 let me run the query. Are the updated docs where it is stated the supported versions of the libraries integrations?

LuchiLucs avatar Feb 04 '25 12:02 LuchiLucs