sector119 wrote:
>
> Hi All!
>
> Why I get at SET part not only items from values(...), but all from
> params passed to session.execute?
>
>>>> transactions_update =
>>>> model.transactions_table.update().where(and_(model.transactions_table.c.commit_date==bindparam('commit_date'),
>>>> model.transactions_table.c.serial==bindparam('serial'),
>>>> model.transactions_table.c.office_id==bindparam('office_id'))).values(rollback_date=bindparam('rollback_date'),
>>>> rollback_time=bindparam('rollback_time'),
>>>> rollback_user_id=bindparam('rollback_user_id'))
>
>>>> meta.Session.execute(transactions_update,
>>>> 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})
>
> 17:31:50,761 INFO  [sqlalchemy.engine.base.Engine.0x...f34c] 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
>
> 17:31:50,761 INFO  [sqlalchemy.engine.base.Engine.0x...f34c]
> {'rollback_date': '2009-10-22', 'sum': 111, 'commit_date':
> '2009-10-22', 'office_id': 1, 'rollback_time': '11:12:15',
> 'rollback_user_id': 1, 'serial': 1}
> <sqlalchemy.engine.base.ResultProxy object at 0xac38c0c>

execute(clauseelement, params) passes the keys given in the first
parameter set to the compiler, where those that match column names in the
table are added to the total field of keys used to generate the VALUES or
SET clause of an insert() or update() construct, respectively.

you could myupdate.compile(engine=myengine) the construct first which
would fix it to a certain string though likely cleaner to pass the exact
set of parameters desired.




>
> >
>


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

Reply via email to