Proving an example to replicate this issue:
Consider the following Pandas Dataframe called my_data:
| id | coordinates |
| 01| [50.1, 68.2] |
|02| [52.2, 67.9] |
and consider the following postgresql table definition
CREATE TABLE coordinates (
id int2,
coordinates int8range
);
Now, even if you cast this dataframe column to the type object
my_data['coordinates'] = my_data['coordinates'].astype(object)
the following insert operation throws an error:
d6tstack.utils.pd_to_psql(my_table, db, table, schema if_exists='replace')
The Error log is:
BadCopyFileFormat: extra data after last expected column
The same insert operation works with dataframe.to_sql functionality provided by psycopg2
Proving an example to replicate this issue: Consider the following Pandas Dataframe called my_data: | id | coordinates | | 01| [50.1, 68.2] | |02| [52.2, 67.9] |
and consider the following postgresql table definition
CREATE TABLE coordinates ( id int2, coordinates int8range );
Now, even if you cast this dataframe column to the type object
my_data['coordinates'] = my_data['coordinates'].astype(object)
the following insert operation throws an error:
d6tstack.utils.pd_to_psql(my_table, db, table, schema if_exists='replace')
The Error log is: BadCopyFileFormat: extra data after last expected column
The same insert operation works with dataframe.to_sql functionality provided by psycopg2