在postgres中批量upsert(插入更新)csv

时间:2014-06-16 16:09:06

标签: python sql postgresql csv

我正在寻找一种批量“upsert”csv的好方法。该表是:

category_id (indexed but not unique)      post_id (indexed and unique)

post_id只能代表一次。

有没有好办法呢?

要进行批量插入,我在psql中使用了COPY posts FROM 'posts.csv' CSV;,但我从未做过批量“存在更新,否则插入”操作类型。

0 个答案:

没有答案
相关问题