bulk_create with on_conflict

44 views
Skip to first unread message

Bruno Godoy Martins Corrêa

unread,
Oct 5, 2020, 8:20:18 PM10/5/20
to peewee-orm
Hi everybody,

I'd like to know if there is a way to use `on_conflict` with `bulk_create`.

Best regards,
Bruno Correa.

Charles Leifer

unread,
Oct 6, 2020, 9:46:38 AM10/6/20
to peewe...@googlegroups.com
The problem with specifying `on_conflict` with `bulk_create()` is that it's impossible (on Postgres) to map the returned IDs for new rows to the instances you passed in.

If you need to specify on_conflict I suggest you just use insert_many().

--
You received this message because you are subscribed to the Google Groups "peewee-orm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to peewee-orm+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/peewee-orm/a23cbeab-9ea1-40c1-babd-c7127a8f69b9n%40googlegroups.com.

Bruno Godoy "Goiaba"

unread,
Oct 6, 2020, 6:56:10 PM10/6/20
to peewe...@googlegroups.com
Hum, I got it. I've replaced bulk_create by insert_many as you suggested.

Thank you for the advice.
-----------------------------------------------------
My PGP public key is available here


You received this message because you are subscribed to a topic in the Google Groups "peewee-orm" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/peewee-orm/BbrLLmT8ni0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to peewee-orm+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/peewee-orm/CAPukbqx0FkS5p7_PLuLu_mUHQ21cB%2BuDEV88njWHSCNDXqTCxg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages