tobgu/qframe

INSERT INTO table (id, name, age) VALUES(1, "A", 19) ON DUPLICATE KEY UPDATE

2kikee122 opened this issue · 2 comments

Is it possible to save a qframe, where we update primary keys if they exist?

This functionality is not currently available in QFrame, colloquially what you describe is an upsert.

 A(i)  B(s)
----- -----
    1   one
    2   two
// generates a prepared statement like:
INSERT INTO table (A, B) VALUES (?, ?);

We would just need to add an option to generate a dialect specific statement like ON CONFLICT .... You can see how the prepared statement is created here.

I forgot to mention that I wrote a fix for allowing upserts in qframe in #29 but I haven't had a chance to finalize it, feel free to give it a try.