Search Postgresql Archives

Re: Bulk Insert/Update Scenario

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx         | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson <https://www.edge.org/>

Attachment: signature.asc
Description: PGP signature


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux