Hi Mike,
Thanks, `literal` is good.
Regarding the `insert_where` function, would you mind providing some
feedback on the API? I'm writing a library that uses SQLAlchemy so I would
like this API to be relatively consistent with the SQLAlchemy approach.
So far I have been doing it like the
On Tue, Mar 22, 2022, at 2:46 PM, mkmo...@gmail.com wrote:
> I would like to do a conditional insert of a a single row. This is often
> useful in a CRUD app for checking permissions and inserting in a single
> database call:
>
> INSERT INTO project (name, user_id)
> SELECT :name, :user_id
>
I would like to do a conditional insert of a a single row. This is often
useful in a CRUD app for checking permissions and inserting in a single
database call:
INSERT INTO project (name, user_id)
SELECT :name, :user_id
WHERE EXISTS (
SELECT 1
FROM users
WHERE id = :user_id