On 6/30/07, Michael Bayer <[EMAIL PROTECTED]> wrote:
>
>
>
>
> On Jun 30, 4:41 pm, SamDonaldson <[EMAIL PROTECTED]> wrote:
> > I wrote a custom query and selected a few columns out of a table.  I
> > then wanted to 'instantiatize' it so that i could reference the
> > attributes as an object so I did that by calling the constructor of
> > the sqlalchemy class that maps to the table.  Now, I believe, since
> > these classes were instantiated, sqlalchemy will try to force commit
> > them at the end of the session.
>
> not at all.  SA doesnt do anything automatic in this regard; only if
> you say session.flush().
>
> however: i am under the impression that Turbogears issues an explicit
> SessionTransaction for every controller method.  if so, this action
> *will* issue a flush() for every controller request.  so this would be
> because thats how TG does it, via closing their SessionTransaction.
> Pylons doesnt do anything like this..its much less opinionated.


This is what messed me up too when I first starting using SA w/ turbogears.
 I did not know that a transaction occurred automatically with the
controller and I wanted to use a transaction as part of the error handler
validation and if a transaction failed do something.  I later figured it out
with the help of a few friends, but it is kind of a gotcha for people using
TG1.0 as they may read the SA tutorial like good children and hear about all
of the explicit handling of transactions, which is good I agree, then they
use TG controller and is implicit.


-- 
http://www.blog.noahgift.com

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to