if you want to issue a single UPDATE in an atomic fashion like that,
drop down to plain SQL to do it.
On Mar 26, 2007, at 2:27 AM, Denis Shaposhnikov wrote:
>
> Hi!
>
> I have a question. May be someone able to give me advice. For example
>
>>>> users_table = Table('users', meta,
> ... Column('user_id', Integer, primary_key=True),
> ... Column('a', Integer)
> ... )
>
>>>> class User(object):
> ... pass
>
>>>> mapper(User, users_table)
>>>> u = session.query(User).get(1)
>
> What's the best way to add some value to `u.a`? I mean, safe way,
> because several processes want to add some value. Is it possible to do
> something like
>
>>>> u.a = u.a + 21
>>>> session.flush()
>
> and give something like
>
> UPDATE users SET a = a + 21
>
> ?
>
> Or do you know some other way?
>
> Thanks!
>
> --
> DSS5-RIPE DSS-RIPN 2:550/[EMAIL PROTECTED] 2:550/[EMAIL PROTECTED]
> xmpp:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] http://neva.vlink.ru/~dsh/
>
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---