Hi you can also try out http://gthc.org/projects/notmm/0.2.12/
if you feel adventurous and if you are not afraid of using the pdb to find problems in your very own app, not the django one. althought its clear to me that sometimes the best approach for adding sessions depends on the scope of your application, disregarding any consensus whatsoever... peace erob On Fri, Apr 24, 2009 at 11:03 AM, Jeff FW <jeff...@gmail.com> wrote: > > Definitely go with middleware--it's very clean and simple. Also, make > sure to use sqlalchemy.orm.scoped_session()--it makes using sessions > in Django pretty much transparent; any time you need to work with a > session, you call Session(), and it either uses your current one, or > creates a new one if necessary. > > Coincidentally, I actually wrote in that first thread you linked > to. :-) > > -Jeff > > On Apr 23, 5:30 pm, Michael Trier <mtr...@gmail.com> wrote: > > Hi, > > > > On Thu, Apr 23, 2009 at 4:05 PM, davidlmontgomery < > > > > > > > > davidlmontgom...@gmail.com> wrote: > > > > > I would like to know if there is a consensus on the best > > > way to set up and remove sqlalchemy Sessions in django. > i wrote a with_session(engine) decorator for adding a scoped session on a per view basis. i use this, and im happy with it > > > > I figure I'm either going to use middleware, something like this > > > thread: > > > > >http://groups.google.com/group/django-users/browse_thread/thread/e674. > .. > > > > > or I'm going to use signals, something like this post: > > > > >http://translate.google.com/translate?hl=en&sl=ja&u=http://d.hatena.n. > .. > > > > > Any clear advantages or disadvantages for the two approaches? > > > > Personally I find the Middleware approach cleaner and allows you to > handle > > exceptions with rollbacks as indicated in the django-users thread. There > > was a project Tranquil (http://code.google.com/p/tranquil/) that > expanded on > > this idea to inject more stuff into the request automatically. It's > pretty > > much dead at this point from what I understand. > > Additionally I'll point out that I have a project called > Django-SQLAlchemy > > (http://gitorious.org/projects/django-sqlalchemy) that has the aim of > > automatically making SQLAlchemy accessible through Django applications. > > > > Good luck. > > > > -- > > Michael Trierhttp://michaeltrier.com/http://thisweekindjango.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 sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---