On Wed, Dec 24, 2008 at 3:18 AM, Rotem Tamir <[email protected]> wrote:
>
keep in mind that with SA you have sevral ways of doing this. You
could have used attributes on the table object directly, also since
your using Elixir, they expose the table object directly. Last but not
least you should drop the 'c' attribute as that is no longer supported
at SA 0.5 
http://www.sqlalchemy.org/trac/wiki/05Migration#ObjectRelationalMapping

> 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))
>  )

I know this is totally unrelated but "Organ" and "children" in the
same sentence kind of gives the whole code a dark twist.

--~--~---------~--~----~------------~-------~--~----~
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