On 2018-01-04 13:47:49 -0800, Mana M wrote:
> I was thinking about dumping everything into TEMP table and using that
> as source for INSERT ... ON CONFLICT. However, I was not sure on how
> to get thousands of rows from my Python application into TEMP table in
> one shot. Or is there any better alternatives?
Psycopg2 can decent support for copy:
http://initd.org/psycopg/docs/cursor.html#cursor.copy_from
(but I had problems copying more than 2GB from a StringIO buffer. Not
sure whether that was a problem with psycopg or StringIO.)
Alternatively you can just invoke psql -c '\copy ...'
hp
--
_ | Peter J. Holzer | we build much bigger, better disasters now
|_|_) | | because we have much more sophisticated
| | | hjp@hjp.at | management tools.
__/ | http://www.hjp.at/ | -- Ross Anderson <https://www.edge.org/>