support insert ignore , on duplicate key update or replace for mysql?
See original GitHub issuesupport insert ignore , on duplicate key update or replace for mysql. I want to use insert_many
to insert data into mysql. But one of column is a UNIQUE KEY
so how to solve this.
I hope it can like this execute(ignore=True)
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
"INSERT IGNORE" vs "INSERT ... ON DUPLICATE KEY ...
If you use both INSERT IGNORE and ON DUPLICATE KEY UPDATE in the same statement, the update will still happen if the insert...
Read more >13.2.7.2 INSERT ... ON DUPLICATE KEY UPDATE Statement
The ON DUPLICATE KEY UPDATE clause can contain multiple column assignments, separated by commas. The use of VALUES() to refer to the new...
Read more >Duplicate and Ignore on MySQL Inserts
Duplicate and Ignore on MySQL Inserts. MySQL table primary keys and unique indexes prevent multiple rows with the same index from being added...
Read more >MySQL INSERT ON DUPLICATE KEY UPDATE
This tutorial shows you how to use MySQL INSERT ON DUPLICATE KEY UPDATE statement effectively by practical examples.
Read more >INSERT ON DUPLICATE KEY UPDATE - MariaDB
INSERT ... ON DUPLICATE KEY UPDATE is a MariaDB/MySQL extension to the INSERT statement that, if it finds a duplicate unique or primary...
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 FreeTop 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
Top GitHub Comments
The big problem with
upsert()
in MySQL is that it generates aREPLACE INTO
which deletes the matching rows and re-inserts them. If there is a foreign key to that row then those keys are taken into account (either cascading the delete or blocking the delete). However, anINSERT INTO ... ON DUPLICATE KEY UPDATE
doesn’t have this issue.OK . I find only
ignore
in InsertQuery.on_conflict. But what isINSERT OR IGNORE INTO
? In Mysql onlyINSERT IGNORE INTO
is right( I didn’t use PostgreSQL or SQLite ). I think you should divide peewee into different versions for different DBMS and it can adapt to some features in different DBMS.I like peewee than SQLAlchemy because the former‘s document and api design are much more beautiful than the latter. I hope peewee become more perfect.