Re: Help understanding pylons' model and sqlalchemy usage

2009-10-12 Thread Jonathan Vanasco
if you want to go all crazytime... have a routine in meta.py that figures out all the classes in the modules that you load, and assign the orm/mapper stuff into class variables --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Help understanding pylons' model and sqlalchemy usage

2009-10-12 Thread Wyatt Lee Baldwin
On Oct 12, 1:38 pm, Dan06 wrote: > Is it better to reflect and map the tables in the meta.py file or just > create the engine, meta data, and the session in the meta file and > have each model file reflect and map its respective table? An example > of the latter follows: I would recommend someth

Re: Help understanding pylons' model and sqlalchemy usage

2009-10-12 Thread Dan06
Is it better to reflect and map the tables in the meta.py file or just create the engine, meta data, and the session in the meta file and have each model file reflect and map its respective table? An example of the latter follows: # meta.py from sqlalchemy import schema, engine, orm pg_db = engi

Re: Help understanding pylons' model and sqlalchemy usage

2009-10-07 Thread Jonathan Vanasco
sqlalchemy calls the behavior you're looking for 'reflecting' a pylons -- or non-pylons -- approach to handling this might be such ( old sqlalchemy 4 code ): 1. have a 'meta' module, that has code like this: from model import * engine = sqlalchemy.create_engine('postgres://app:a...@loc

Re: Help understanding pylons' model and sqlalchemy usage

2009-10-07 Thread Wyatt Lee Baldwin
On Oct 7, 9:46 am, Dan06 wrote: > I've recently started pylons, and I've put together some practice > code. However, I'm unclear on how pylons models should be constructed > and I'm unsure if I've correctly used sqlalchemy. My practice code has > 2 relevant files, books_meta.py (model) and books.

Help understanding pylons' model and sqlalchemy usage

2009-10-07 Thread Dan06
I've recently started pylons, and I've put together some practice code. However, I'm unclear on how pylons models should be constructed and I'm unsure if I've correctly used sqlalchemy. My practice code has 2 relevant files, books_meta.py (model) and books.py (controller), which you'll find below.