postgres

The psycopg2 library and execution speed

The psycopg2 library is by far the most popular PostgresSQL adapter to use with Python. I have personally used it extensively to build a number of ETL frameworks across many organisations and have found it extremely easy to use and very versatile. One area which I have found the library to struggle with is inserting/updating large amounts of data into database tables. The library comes with (what I thought at the time) a nice and performant method executemany(query, params) which executes a SQL query against a list of vars. I assumed that the executemany() method would be the fastest way […]