Skip to content
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

Merge look at ON Conflict #22

Closed
visch opened this issue Oct 28, 2022 · 5 comments
Closed

Merge look at ON Conflict #22

visch opened this issue Oct 28, 2022 · 5 comments

Comments

@visch
Copy link
Member

visch commented Oct 28, 2022

    > generate_insert_statment

@BuzzCutNorman The API is a WIP, and generate_insert_statement is currently expected to return an insert statement as a string. I have not surveyed different databases for upsert methods, but I think most should be able to extent the basic INSERT INTO <table> (<columns...>) VALUES (...) with something like ON CONFLICT (<pk...>) DO UPDATE SET .... So, the overriding pattern could look something like:

def generate_insert_statement(
    self,
    full_table_name: str,
    schema: dict,
):
    stmt = super().generate_insert_statement(full_table_name, schema)
    stmt += "ON CONFLICT ...`

Wdyt?

Originally posted by @edgarrmondragon in #9 (comment)

@visch
Copy link
Member Author

visch commented Oct 28, 2022

@visch
Copy link
Member Author

visch commented Oct 28, 2022

#9 (comment)

@visch
Copy link
Member Author

visch commented Jan 16, 2023

This is one piece of #64

@visch
Copy link
Member Author

visch commented Jun 8, 2023

Decided against this as key constraints could change, I think an upsert as we're doing it makes life a bit simpler than relying on constraints being set properly (Maybe I'm wrong?)

@visch
Copy link
Member Author

visch commented Jun 15, 2023

Solved with #138

@visch visch closed this as completed Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant