Hi!

Is there a way to find out about the state an object is in? I am
particular interested to find out if there is the need to call
session.update() for an object or if the identidy is already contained
in the session. I cannot manage to do this, but get an Invalid Request
Errror.

So the example to get the InvalidRequestErrro goes as follows:

    session = Session()
    obj1 = session.query(Advertisment).get(1)
    session.expunge(obj1)
    obj2 = session.query(Advertisment).get(1)
    session.update(obj1)  # raises InvalidRequestError

I would like to do something like:

if not obj1 in session:
    session.update(obj1)

Any help would be appreciated very much.
Thanks, Jan





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