-
Notifications
You must be signed in to change notification settings - Fork 6
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
Provide syntactic sugar for upserting a record #18
Comments
Basically syntax for an
In addition to that, user can specify what to return after the execution of an upsert query. Such as, the record before update/insert happens, record after update/insert, custom fetched columns after update/insert, or nothing. These values may be defined using clauses RETURN_BEFORE, RETURN_AFTER, RETURN_COLUMNS, RETURN_NONE respectively. Eg: Upsert query would look like $DSL.upsert {
TARGET (...)
JOIN { ... } // optional
SET { ... }
WHERE { ... }
RETURN_AFTER() // new clause user has to specify what to return
} |
Currently if a user wants to insert if not exist or update (upsert) a particular record to a table, he/she must write a script to do it which having at least three queries; one for check the existence, other for inserting, and another for updating.
It is nice to provide an upsert syntax to do this is one single expression (or query). AFAIK there are no rdbms database having a single syntax for upserting, but it is believed NyQL can do this by simulating these three steps automatically.
Need to think about how the syntax would like be.
The text was updated successfully, but these errors were encountered: