Christian Démolis wrote:
> Thx for your answer.
> MakeReleased is a method of com object windows agent (self.agent =
> DispatchWithEvents('CosmoAgent.clsCCAgent', Evenement))
> It takes 0 second to execute as we can see in the execute print

yes I realized later there were two blocks of timer calls.  The inclusion
of that code made the example harder to read.

In particular using session.merge() with an object will issue a SELECT
first to locate the current row.   this is likely the cause of the
slowness in this specific case since you seem to have a slow network
(profiling would reveal this too).   Passing "dont_load=True" to merge()
will skip the SELECT step and trust that the state you are passing it is
the state that is within the database.

> "Orm does additional steps"
> is it possible to force him update only one attribute of the object?

you may say:

session.query(MyObject).filter(some_criterion).update({'attrname':somenewvalue},
False)

which will issue an UPDATE statement matching the criterion.  this is the
fastest way by far using the ORM only.

Changing the "False" to "evaluate" or "expire" will also update or expire
the state of your ORM instance - but that will add some overhead.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@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=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to