On Aug 6, 2007, at 3:22 PM, Paul Colomiets wrote:
>
> Hi!
>
> Can somebody point me why this fails?
>
>>>> meta = MetaData(bind="sqlite:///:memory:")
>>>> blocks = Table('blocks', meta,
> ... Column('id', Integer, primary_key=True, autoincrement=True),
> ... Column('lines', Integer),
> ... Column('lastline', Integer),
> ... )
>>>> blocks.create()
>>>> blocks.update().execute(lines = blocks.c.lines + 1)
cant put SQL expressions inside of execute(); those are literal bind
params only. put them in values:
blocks.update(values={'lines':blocks.c.lines+1}).execute()
or
blocks.update(values={blocks.c.lines:blocks.c.lines+1}).execute()
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---