Re: bulk_create on Postgresql: on conflict do nothing / post_save signal

2017-10-01 Thread Дилян Палаузов
Hello, fetching 3GB of existing records to only pass afterwards to bulk_create() some non-existent ones is not feasible. I found a way to convince Postgresql to report which rows were not inserted on INSERT ON CONFLICT DO UPDATE: Consider this: CREATE TABLE t ( id SERIAL PRIMARY KEY, na

Re: bulk_create on Postgresql: on conflict do nothing / post_save signal

2017-09-28 Thread Tom Forbes
I've been in similar situations before, you can usually get away with using a single query to fetch existing records and only pass data that doesn't exist to bulk_create. This works great for a single identity column, but if you have multiple it gets messy. It seems all supported databases offer a

bulk_create on Postgresql: on conflict do nothing / post_save signal

2017-09-28 Thread Дилян Палаузов
Hello, I want after a user request to be sure that certain objects are stored in a Postgres database, even if before the request some of the objects were there. The only way I can do this with django, not talking about raw sql, is with "for obj in objects: Model.objects.get_or_create(obj)".