On Mon, Sep 13, 2010 at 10:03:16AM -0700, Kirk Strauser wrote:
> On Sep 13, 11:52 am, cd34 <[email protected]> wrote:
> > On Sep 13, 11:03 am, Kirk Strauser <[email protected]> wrote:
> >
> > > from sqlalchemy.ext.declarative import declarative_base
> > > Base = declarative_base()
> > > Pylons, though, wants those models to inherit from its own base class,
> > > like:
> >
> > > from myapp.model.meta import Base
> >
> > If you look at the model, /myapp/model/meta.py, you'll find:
> >
> > from sqlalchemy.ext.declarative import declarative_base
> > Base = declarative_base()
> >
> > which is the same declaration you're using.  You should be able to use
> > one or the other and utilize the same models for your standalone and
> > Pylons app.  I do the same with a few projects, though, in reverse.
> > Pylons models that I use directly in Python with the appropriate from
> > declarations.
> 
> Outstanding! I think it's time to start experimenting again.

AFAIU it's just a matter of making sure you use the same MetaData object
for your models and the sessions that Pylons manage for you.

Marius Gedminas
-- 
Windows 98: Not Plug & Play, but Bug & Pay!

Attachment: signature.asc
Description: Digital signature

Reply via email to