Re: [sqlalchemy] Could anyone please help explain "expired object" in plain language?

2014-02-24 Thread Bao Niu
Sqlalchemy is great! The more I explore, the more inner beauty of it I realize. On Feb 24, 2014 8:15 AM, "Jonathan Vanasco" wrote: > To expand and clarify Simon's answer into bulletpoints : > > Expired Object > * The database Session the object belongs to has been closed ( or > committed unless y

Re: [sqlalchemy] Could anyone please help explain "expired object" in plain language?

2014-02-24 Thread Jonathan Vanasco
To expand and clarify Simon's answer into bulletpoints : Expired Object * The database Session the object belongs to has been closed ( or committed unless you tweaked the config ) * SqlAlchemy considers it 'expired' because it is not reasonable to expect the object to reflect the current state o

Re: [sqlalchemy] Could anyone please help explain "expired object" in plain language?

2014-02-24 Thread Simon King
When you first load an object from the database, it is considered "clean". When you then start to change its attributes, it becomes "dirty". When you call session.commit(), all the dirty objects in the session are written to the database. However, it is possible that while you have been operating

Re: [sqlalchemy] Could anyone please help explain "expired object" in plain language?

2014-02-24 Thread Bao Niu
Sorry for my slowness, but I still have a minor problem understanding "expired object". Why does it always assume that the database carries the most recent and desired data so that the instances in memory are marked expired? Can't an "expiration" mean the other way around, in which the objects in m

Re: [sqlalchemy] Could anyone please help explain "expired object" in plain language?

2014-02-23 Thread Michael Bayer
As our documentation ability is growing more sophisticated, I’ve taken advantage of this to update and expand the “Expiration” section of the documentation, including with some links to the outside regarding the important concepts. I’m running out the door and the docs are still building, but i

Re: [sqlalchemy] Could anyone please help explain "expired object" in plain language?

2014-02-23 Thread Gunnlaugur Thor Briem
It means that an object in memory (or some of its attributes), representing an entity in the DB, is no longer considered to reflect the state of that entity accurately because the entity may have changed in the DB. So next time attributes are read from the object, fresh DB state is queried. See htt

[sqlalchemy] Could anyone please help explain "expired object" in plain language?

2014-02-23 Thread Bao Niu
I read the documentation several times yet still didn't find an official definition for "expired object", although it is used quite often. To my understanding, it means when you update some attributes on a persistent object, so those affected attributes that are still lying in database become "