I need to do an update like this:

connection.execute('update orders set priority = priority - 1 where priority 
  >= :priority', priority=order.priority)

I am using explicit sessions, so trying

connection = session.connection()

But, I was looking at 

http://www.sqlalchemy.org/docs/sqlconstruction.myt#sql_update

And trying to figure out how to do something like:

Orders.update(
    Orders.c.priority >= priority,
    values={Orders.c.priority:Orders.c.priority+1}
)

First, I don't expect that update to work because adding 1 to a column doesn't 
make sense, and second I couldn't see how Orders gets its engine context.

Then I see other examples like

connection.execute(Orders.update(), {values})

and I'm perplexed at what Orders.update() is returning.. 



-- 
Brad Clements,                [EMAIL PROTECTED]    (315)268-1000
http://www.murkworks.com                          
AOL-IM or SKYPE: BKClements



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to