Django bulk_create with ignore rows that cause IntegrityError?

This is now possible on Django 2.2 Django 2.2 adds a new ignore_conflicts option to the bulk_create method, from the documentation: On databases that support it (all except PostgreSQL < 9.5 and Oracle), setting the ignore_conflicts parameter to True tells the database to ignore failure to insert any rows that fail constraints such as duplicate … Read more

In PostgreSQL, how to insert data with COPY command?

COPY tbl FROM STDIN; is not supported by pgAdmin. You get a plain syntax error because Postgres gets the data as SQL code. Four possible solutions: 1. Use a multi-row INSERT instead: INSERT INTO beer(name, tags, alcohol, brewery, id, brewery_id, image) VALUES (‘Bons Voeux’, ‘blonde’, 9.5, ‘Brasserie Dupont’, 250, 130, ‘generic.png’) , (‘Boerke Blond’, ‘blonde’, … Read more