[sqlalchemy] MySQL INSERT ... ON DUPLICATE KEY UPDATE

2010-08-13 Thread brian
http://github.com/bedwards/sqlalchemy_mysql_ext

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] MySQL INSERT ... ON DUPLICATE KEY UPDATE

2010-08-13 Thread Michael Bayer
nice job.   I didn't think MySQL supported RETURNING ?   that can all go away 
if so.   Also how do i specify an UPDATE clause distinct from the INSERT ?  The 
mysql docs seem to indicate this is possible (i.e. it would UPDATE c=c+1 
instead of inserting 5 columns).   Generative would be nice:

table.insert().values(a=1, b=2, c=3).on_duplicate_update(c=table.c.c + 1)

you'd be monkeypatching the Insert construct instead of Table with the 
above, adding on_duplicate_update() that would copy the original Insert into 
your construct.   A default for everything might be on_duplicate_update('*').

MySQL is confusing here...there's REPLACE also and I always thought that was 
their INSERT or UPDATE solution.   This one seems much more useful.




On Aug 13, 2010, at 12:37 AM, brian wrote:

 http://github.com/bedwards/sqlalchemy_mysql_ext
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 sqlalchemy group.
 To post to this group, send email to sqlalch...@googlegroups.com.
 To unsubscribe from this group, send email to 
 sqlalchemy+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/sqlalchemy?hl=en.
 

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.