finally the function:

def UpdateListDelta(list,delta):
  """
  This function receives a list of Organ IDs and runs an UPDATE query
on them to add a delta(float)
  to the sum_active_nodes_of_children column.
  """
  from sqlalchemy import update
  from turbogears.database import session

  session.execute(
    update(
      Organ.table,
      values = {Organ.c.sum_active_nodes_with_children:
Organ.c.sum_active_nodes_with_children+delta}
    ).where(Organ.c.code.in_(list))
  )

thanks all for the help!

On Dec 23, 7:20 pm, "Diez B. Roggisch" <[email protected]> wrote:
> Rotem Tamir schrieb:
>
> > i've read the documentation and stil couldn't figure out.
> > however after a few more hours of googling i found that there is a way
> > to do this:
>
> > BudgetTreeNode.table.update(BudgetTreeNode.c.id.in_
> > (1,2,3,4,5,43,66)).execute(value=100)
>
> > but if i try to set value=value+1 it complains that value is undefined
> > (obviously)
>
> > any clues?
>
> value=BudgetTreeNode.value + 100
>
> might work. If not, please re-read my post.
>
> Diez
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to