I'm trying to implement the common "insert if not exists" pattern using
sqlalchemy, but after a day of googling can't find out how to do it:

My query is like (sqlite backend):

INSERT INTO memos(id,text) SELECT 5, 'text to insert' WHERE NOT EXISTS(SELECT 1 
FROM memos WHERE id = 5 AND text = 'text to insert');


I know how to create the subquery, but just can't figure out 
how to pass the result of the subquery to insert, especially
 this subquery returns 2 fields.

Can anyone please help? 





-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to