On Nov 13, 2007, at 7:46 PM, Huy Do wrote:
> > Hi Rick, >> I use a similar technique with a Pylons controller, but instead of >> engine.begin(), I use session.begin(). Then by passing around the >> session for all calls made by that controller, > I had so much legacy SA code, that I just couldn't easily retrofit > this > pattern throughout the code, but thanks for the tip. >> I can use Session.execute() for expression-based and text-based SQL >> mixed with ORM ops, and it all commits in one shot on one thread >> without using threadlocal. This allows the freedom to open another >> session in a separate transaction for those odd places where it's >> needed, and have arbitrary expression-based SQL execute in that other >> transaction -- something I don't think >> you'll be able to do with threadlocal + implicit execution. > I was hoping that I could create a another session using another > engine > (non threadlocal), for these special cases. I have not yet run into > this > need yet. Just out of interest, have you run into any such use cases ? > > Thanks > if youre using threadlocal engine, you can still say engine.connect() and get a Connection that is not part of the threadlocal context (and start transactions off that connection, bind it to sessions, whatever). therefore you really dont lose anything when using threadlocal. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---