Re: Best practices for where to work with SQLAlchemy

2011-05-19 Thread Michael Merickel
Assuming "transaction.close" is a typo and you meant "transaction.commit", you may want to think about not calling it at all and allowing the transaction manager (repoze.tm2 or pyramid_tm) handle performing the commit for you. The reason for this is that your changes will automatically be rolled ba

Re: Best practices for where to work with SQLAlchemy

2011-05-19 Thread Chris McDonough
On Thu, 2011-05-19 at 17:14 -0700, Alec Munro wrote: > So I have a few pylons and pyramid applications under my belt, almost > all using SQLAlchemy. So far, I have gravitated towards doing all the > SQLAlchemy work as part of the models themselves. Occasionally, this > has led to design decisions

Best practices for where to work with SQLAlchemy

2011-05-19 Thread Alec Munro
So I have a few pylons and pyramid applications under my belt, almost all using SQLAlchemy. So far, I have gravitated towards doing all the SQLAlchemy work as part of the models themselves. Occasionally, this has led to design decisions that I otherwise wouldn't have made, like having code that aff

Re: How to load Pyramid environment?

2011-05-19 Thread Kai Groner
This is the template I've been using for my paster commands. https://gist.github.com/981224 If you don't want the paster stuff, the loadapp and threadlocal_manager bits are the important ones. Kai On Thu, May 19, 2011 at 11:29 AM, Gopalakrishnan S < gopalakrishnan.subram...@gmail.com> wrote: >

Re: How to load Pyramid environment?

2011-05-19 Thread Michael
Why would you use Pyramid for this? Just use SQLALchemy itself. On Thu, May 19, 2011 at 11:29, Gopalakrishnan S < gopalakrishnan.subram...@gmail.com> wrote: > I have a stand-alone python program which needs the pyramid to be > initialised so that it can take use of models, sessions, etc without

How to load Pyramid environment?

2011-05-19 Thread Gopalakrishnan S
I have a stand-alone python program which needs the pyramid to be initialised so that it can take use of models, sessions, etc without serving web request.. Is it possible in Pyramid? I was using the same with pylons, wonder how Pyramid support this. -- You received this message because you are

Reusing sqlalchemy models across several pyramid apps

2011-05-19 Thread 371c
Hi all, Scenario: i have a couple of models that i'd like to reuse across 3 different pyramid apps (p1, p2, p3). The idea is to: * create a separate project (eg. models_app) to be installed into the python env via "python setup install" - sort of like a shared library. * In p1, p2 and/or p3, im