On Jan 13, 7:07 pm, Jorge Vargas <[email protected]> wrote: > On Tue, Jan 13, 2009 at 3:32 PM, grassoalvaro <[email protected]> wrote: > > > Hi, > > > Can someone tell me how to declare models using sqlalchemy 5.0? > > When i'm trying something like that: > > > class Worker(object): > > __tablename__ = 'workers' > > id = Column(Integer, primary_key=True) > > > and next i'm importing it in model.__init__, command paster setup-app > > dosn't create declared table. > > please review the SA documentation it excels at well everything. > > You are probably trying to use "SA declarative" which means you > classes need to extend "declarative base" rather than object. As > explained > herehttp://www.sqlalchemy.org/docs/05/ormtutorial.html#creating-table-cla...
Also, you need to call the method for creating tables (metadata.create_all or something like that); paster doesn't do that for you. Some people do that in websetup.py. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
