Re: Testing of a fast method to bulk insert a Pandas DataFrame into Postgres

2021-10-04 Thread Adrian Klaver
On 10/4/21 10:28 AM, Adrian Klaver wrote: On 10/4/21 10:10 AM, Shaozhong SHI wrote: Hello, Adrian Klaver, What is the robust way to upgrade Pandas? Carefully. The most recent version is 1.3.3, which is approximately 5 versions ahead of where you are now. The big jump is when Pandas went from

Re: Testing of a fast method to bulk insert a Pandas DataFrame into Postgres

2021-10-04 Thread Adrian Klaver
On 10/4/21 10:10 AM, Shaozhong SHI wrote: Hello, Adrian Klaver, What is the robust way to upgrade Pandas? Carefully. The most recent version is 1.3.3, which is approximately 5 versions ahead of where you are now. The big jump is when Pandas went from 0.25 to 1.0. See docs here: https://pan

Re: Testing of a fast method to bulk insert a Pandas DataFrame into Postgres

2021-10-04 Thread Shaozhong SHI
Hello, Adrian Klaver, What is the robust way to upgrade Pandas? Regards, David On Monday, 4 October 2021, Adrian Klaver wrote: > On 10/4/21 9:20 AM, Shaozhong SHI wrote: > >> Hello, Adrian Klaver, >> >> Pandas version is 0.23.0. >> > > The reason the below does not work is method did not show up

Re: Testing of a fast method to bulk insert a Pandas DataFrame into Postgres

2021-10-04 Thread Adrian Klaver
On 10/4/21 9:20 AM, Shaozhong SHI wrote: Hello, Adrian Klaver, Pandas version is 0.23.0. The reason the below does not work is method did not show up until pandas 0.24.0. I used the following code: def psql_insert_copy(table, conn, keys, data_iter):     # gets a DBAPI connection that ca

Re: Testing of a fast method to bulk insert a Pandas DataFrame into Postgres

2021-10-04 Thread Rob Sargent
> On Oct 4, 2021, at 10:20 AM, Shaozhong SHI wrote: > > Hello, Adrian Klaver, > > Pandas version is 0.23.0. > > I used the following code: > > def psql_insert_copy(table, conn, keys, data_iter): > # gets a DBAPI connection that can provide a cursor > dbapi_conn = conn.connection >

Re: Testing of a fast method to bulk insert a Pandas DataFrame into Postgres

2021-10-04 Thread Shaozhong SHI
Hello, Adrian Klaver, Pandas version is 0.23.0. I used the following code: def psql_insert_copy(table, conn, keys, data_iter): # gets a DBAPI connection that can provide a cursor dbapi_conn = conn.connection with dbapi_conn.cursor() as cur: s_buf = StringIO() writer =

Re: Testing of a fast method to bulk insert a Pandas DataFrame into Postgres

2021-10-04 Thread Adrian Klaver
On 10/4/21 8:44 AM, Shaozhong SHI wrote: Has anyone tested this one? A Fast Method to Bulk Insert a Pandas DataFrame into Postgres · Ellis Valentiner I tried psql_insert_copy method, but I got the fo

Testing of a fast method to bulk insert a Pandas DataFrame into Postgres

2021-10-04 Thread Shaozhong SHI
Has anyone tested this one? A Fast Method to Bulk Insert a Pandas DataFrame into Postgres · Ellis Valentiner I tried psql_insert_copy method, but I got the following error message. to_sql() got an unexpec