Michael,

I tried creating a simple standalone example using our data, but the
table relations complexity would make the example fairly huge. So
unfortunately that means I didn't get one working.

In my Pylons applications the sequence of events are as follows:

get a session
create a new item
add the item to the session
session commit
// sometime later
get a session
get an item from the session with a query
modify the qty value of the item
session commit

I have resolved the issue by hacking my code to do the following:

session = Session()
session.query(CoverBatchStackItem) \
.filter((CoverBatchStackItem.cover_batch_id==cover_batch_id) and
(CoverBatchStackItem.order_id==foid)) \
.update({CoverBatchStackItem.qty: qty})
session.commit()

where qty is passed into the method that executes this code. Here I'm
querying for the item and updating it in one long statement. This
works but looks ugly compared to the original code.

Thanks!
Doug

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

Reply via email to