-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add upsert support #23
Conversation
@@ -341,13 +342,16 @@ def get_bind_types( | |||
|
|||
return parameter_types | |||
|
|||
def visit_upsert(self, insert_stmt, visited_bindparam=None, **kw): | |||
return self.visit_insert(insert_stmt, visited_bindparam, **kw).replace("INSERT", "UPSERT") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (blocking) We should not replace all occurrences of "INSERT", because of the unexpected string values content, like:
UPSERT INTO TABLE my_table VALUES('INSERT is my favourite operation')
Also the test of this case should be
@@ -200,3 +202,49 @@ def test_select_types(self, connection): | |||
|
|||
row = connection.execute(sa.select(tb)).fetchone() | |||
assert row == (1, "Hello World!", 3.5, True, now, today) | |||
|
|||
|
|||
class TestUpsert(TablesTest): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (blocking) Let's add also tests with several UPSERTs and UPSERT FROM SELECT, if it is supported, not sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Thanks
No description provided.