Hello everyone,

I have tested that session.add(changed_sqla_object) in at least one 
context (when the object with id of changed_sqla_object already exists 
in the db) does issue UPDATE sql query and updates the object in the 
database.

However, there's also session.update() method. Help on this says:

> update(self, instance) method of sqlalchemy.orm.session.Session instance
>     Bring a detached (saved) instance into this ``Session``.

Meaning this updates session with the saved object data, and it's not 
that the *changed* object's data that is updated in database?

> 
>     Use session.add()

To do what?

> 
>     If there is a persistent instance with the same instance key, but
>     different identity already associated with this ``Session``, an
>     InvalidRequestError exception is thrown.
> 
>     This operation cascades the `save_or_update` method to associated
>     instances if the relation is mapped with ``cascade="save-update"``.

In general, the question: is it safe to use session.add(changed_object) 
in *all of the circumstances*?

Regards,
mk

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