On Fri, Nov 20, 2009 at 5:14 PM, Mariano Mara <mariano.m...@gmail.com>wrote:

> ... or, at least, is weird for me :)
> Hi everyone. I'm running a pylons controller
> with the following instruction:
>
>        meta.Session.query(ESMagicNumber).filter(
>            ESMagicNumber.uuid==request.params['uuid_']).\
>                update({'last_access':datetime.datetime.now()})
>
> but I'm getting the following error:
>
> (ProgrammingError) syntax error at or near "WHERE"
> LINE 1: UPDATE es_magicnumber SET WHERE es_magicnumber.uuid = E'705...
> ^ 'UPDATE es_magicnumber SET WHERE es_magicnumber.uuid = %(uuid_1)s'
> {'uuid_1': u'705fa1e6-977f-416a-9847-fe8715cc920a'}
>
> I am able to create the same bad SQL, but only if the key in the update
dictionary is not a column in the table being updated. Are you sure
'last_access' is a valid column in ESMagicNumber?

This is because the SET clause is generated from the update dictionary, and
if there are no valid columns, there is nothing to generate and the SET
clause becomes nothing.

--

You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=.


Reply via email to