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

Rename current #upsert(!) methods #790

Open
grepsedawk opened this issue Jan 12, 2022 · 1 comment
Open

Rename current #upsert(!) methods #790

grepsedawk opened this issue Jan 12, 2022 · 1 comment

Comments

@grepsedawk
Copy link
Contributor

As presented in #789 , the upserts in current avram are more of "find_or_create", instead of utilizing upsert from postgres: https://www.postgresql.org/docs/9.5/sql-insert.html (INSERT INTO ... ON CONFLICT UPDATE)

This can be confusing to newcomers expecting upsert to be a single UPSERT query.

@jwoertink
Copy link
Member

The main issue I have with this is that an operation should never be used as a find. That's left to the query objects. I think even though this doesn't perform a DB level upsert, the name still works well since you're either updating a record or inserting a record.

We should look at getting the ON CONFLICT built in to the query builder directly so we can do this in a single query, but I'd like to keep the method name as upsert on this one.

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

2 participants