bulkCreate "INSERT OR IGNORE" capability
See original GitHub issueIs it possible to use bulkCreate to insert multiple rows and ignore if the key is unique and exists? Currently when I update a table I get an error with the following:
{ [SequelizeUniqueConstraintError]
name: 'SequelizeUniqueConstraintError',
message: undefined,
parent:
{ [Error: SQLITE_CONSTRAINT: UNIQUE constraint failed: Files.path]
errno: 19,
code: 'SQLITE_CONSTRAINT',
sql: 'INSERT INTO `Files` (`id`,`path`,`status`,`filename`,`filtered_filename`,`width`,`height`,`size`,`duration`,`createdAt`,`updatedAt`) VALUES ...
Issue Analytics
- State:
- Created 9 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
sequelize Bulkcreate: Ignore if single row fails
I have to import rows from a .csv , and put them in my database (chunks of 500). To do this i'm using...
Read more >MySQL INSERT IGNORE
Let us understand how INSERT IGNORE statement works in MySQL with the help of an example. First, we need to create a table...
Read more >Use BULK INSERT or OPENROWSET(BULK...) to import ...
BULK INSERT loads data from a data file into a table. This functionality is similar to that provided by the in option of...
Read more >Capabilities of InnoDB INSERT Performance
Hi I am running the most recent version of Percona Server. Server version: 5.5.24-55 Percona Server (GPL), Release 26.0. I have a 10...
Read more >INSERT
INSERT INTO table-name ... This insert capability automatically compares unique keys for values to be inserted or ... CREATE TABLE t1 (c1 INT,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If you are using mysql (which it looks like you are), you pass
ignoreDuplicates: trueto the method to have it ignore duplicate/unique constraints.Worth noting that it might not return generated IDs on the JavaScript objects currently: https://github.com/sequelize/sequelize/issues/11223