Re: [sqlalchemy] Could someone please give an example of this paragraph in the Documentation -- Using the session?

2014-03-16 Thread Bao Niu
Got it! It works, that's the main thing! On Sun, Mar 16, 2014 at 8:24 PM, Michael Bayer wrote: > > a1.bs only loads something if there's nothing loaded already, or if the > value was "expired". > > usually, as long as you keep objects associated with a Session, there's no > need to worry about i

Re: [sqlalchemy] Could someone please give an example of this paragraph in the Documentation -- Using the session?

2014-03-16 Thread Michael Bayer
a1.bs only loads something if there's nothing loaded already, or if the value was "expired". usually, as long as you keep objects associated with a Session, there's no need to worry about it as things load as they are needed. but in that specific example, I'm moving an object from one sess

Re: [sqlalchemy] Could someone please give an example of this paragraph in the Documentation -- Using the session?

2014-03-16 Thread Bao Niu
Hi Michael, It really works like magic! I mean the refreshing part. What exactly happens when refreshing a1.bs? Does it actually replace the old b1 inside the collection with a newer one? I can't wrap my mind around it. And more importantly, does it mean I should *refresh* every attributes before

Re: [sqlalchemy] Could someone please give an example of this paragraph in the Documentation -- Using the session?

2014-03-16 Thread Michael Bayer
On Mar 15, 2014, at 7:41 PM, Bao Niu wrote: > Thanks a lot Michael! Just a trivial question here, I noticed in your first > reply you used: > # refresh a1.bs > > Why do we need to refresh it? I tried it in my terminal and it doesn't emit > any sql. Is this one if those secret techniques that

Re: [sqlalchemy] Could someone please give an example of this paragraph in the Documentation -- Using the session?

2014-03-15 Thread Bao Niu
Thanks a lot Michael! Just a trivial question here, I noticed in your first reply you used: # refresh a1.bs Why do we need to refresh it? I tried it in my terminal and it doesn't emit any sql. Is this one if those secret techniques that differentiate a sqlalchemy ninja and a newbie?;) On Mar 15,

Re: [sqlalchemy] Could someone please give an example of this paragraph in the Documentation -- Using the session?

2014-03-15 Thread Michael Bayer
well thats my contribution for today, this is mostly rewritten: http://sqlalchemy.readthedocs.org/en/rel_0_9/orm/session.html#cascades On Mar 15, 2014, at 12:07 PM, Gery . wrote: > I also appreciate such example! Hope simple terminology with a simple example > can replace the sometimes compli

Re: [sqlalchemy] Could someone please give an example of this paragraph in the Documentation -- Using the session?

2014-03-15 Thread Gery .
I also appreciate such example! Hope simple terminology with a simple example can replace the sometimes complicated documentation. Sent from my i386 On Mar 15, 2014, at 16:31, "Michael Bayer" wrote: you have every reason to be confused by that paragraph, which is using way too much terminolog

Re: [sqlalchemy] Could someone please give an example of this paragraph in the Documentation -- Using the session?

2014-03-15 Thread Michael Bayer
you have every reason to be confused by that paragraph, which is using way too much terminology to express what's important there. at some point, we had to add a behavior which I thought would be confusing to people, so that paragraph tries badly to explain what it is. I should replace it wit

[sqlalchemy] Could someone please give an example of this paragraph in the Documentation -- Using the session?

2014-03-15 Thread Bao Niu
I've read this paragraph (http://docs.sqlalchemy.org/en/latest/orm/session.html#unitofwork-cascades) many many times and still can't think of a practical example of what is being discussed. save-update cascade also cascades the *pending history* of the target > attribute, meaning that objects