sector119 wrote:
>
> Something strange, Michael.. All bindparams are different. Compliller
> should not add to SET all params if values() has bindparam args, no?
> where() have:
> bindparam('commit_date'), bindparam('serial'), bindparam
> ('office_id')
> values() have:
> bindparam('rollback_date'), bindparam('rollback_time'), bindparam
> ('rollback_user_id')
>
> All bindparams are different.
OK, what's happening here is that you need to name your bind params
something different than the column names. This should likely be
documented better and perhaps dealt with explicitly, via warning or
exception or such, but the column names are kind of a "reserved namespace"
within the context of an insert() or update() construct. i've added
ticket #1579 to think about changing the behavior entirely, but I might go
with the exception case to start with since it is backwards compatible and
also doesn't impact the complexity of update() compilation very much.
sorry about the gotcha.
>
> params={'commit_date':'2009-10-22', 'serial':1, 'office_id':1,
> 'rollback_date':'2009-10-22', 'rollback_time':'11:12:15',
> 'rollback_user_id':1, 'foobar':1, 'sum':111})
>
> UPDATE transactions SET serial=%(serial)s, office_id=%(office_id)s,
> sum=%(sum)
> s, commit_date=%(commit_date)s, rollback_date=%(rollback_date)s,
> rollback_time=%(rollback_time)s, rollback_user_id=%(rollback_user_id)
> s
> WHERE transactions.commit_date = %(commit_date)s AND
> transactions.serial = %(serial)s AND transactions.office_id = %
> (office_id)s
>
> On 22 ÏËÔ, 19:45, "Michael Bayer" <[email protected]> wrote:
>> sector119 wrote:
>>
>> >> though likely cleaner to pass the exact set of parameters desired.
>>
>> > How to pass that params if I use bindparam at where() and values(),
>> > but I don't want to update colums that are at where() clause, only at
>> > values() ?
>>
>> if you are using bindparam() objects, you'd given them all distinct
>> names.
>>
>>
>>
>>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---