cross-platform MERGE that leverages existing ON CONFLICT, etc. clauses within dialects
See original GitHub issueMigrated issue, originally created by jek (@jek)
Implement generic MERGE, aka ‘upsert’. In ANSI, it looks like:
MERGE INTO table_name1 USING table_name2 ON (condition)
WHEN MATCHED THEN UPDATE SET column1 = value1 [column2 = value2 ...](,)
WHEN NOT MATCHED THEN INSERT columns VALUES (values)
Dialect support differs pretty widely. A quick & likely inaccurate poll:
- Oracle 9+ has a MERGE
- t-sql 2008 has a MERGE, earlier can maybe do
IF EXISTS(SELECT ...)
- MySQL is limited to a key violation condition, and can do either
INSERT ... ON DUPLICATE KEY UPDATE
orREPLACE INTO
, INSERT being preferable - SQLite is limited to a key violation condition, and has
INSERT .. ON CONFLICT REPLACE
Issue Analytics
- State:
- Created 16 years ago
- Comments:40 (4 by maintainers)
Top Results From Across the Web
Towards cross-platform interoperability for machine-assisted ...
In this paper, we investigate cross-platform interoperability for natural language processing (NLP) and, in particular, annotation of ...
Read more >Lucene™ Core News
Apache Lucene is a high-performance, full-featured text search engine library written entirely in Java. It is a technology suitable for nearly any application ......
Read more >How to use `INSERT ON CONFLICT` to upsert data in ... - Prisma
The actual implementation within PostgreSQL uses the INSERT command with a special ON CONFLICT clause to specify what to do if the record...
Read more >RFC 6020: YANG - A Data Modeling Language for the ...
Further information on Internet Standards is available in Section 2 of RFC 5741. Information about the current status of this document, any errata, ......
Read more >Social media in peace mediation - UN Peacemaker
peace mediation, involving official representatives of conflict parties. It provides a snapshot of the current state of play in terms of the role...
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
there’s a WIP for that as well: https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/2230
https://github.com/sqlalchemy/sqlalchemy/issues/4010 found it.