SQLAlchemy declarative syntax with autoload (reflection) in Pylons
问题 I would like to use autoload to use an existings database. I know how to do it without declarative syntax (model/_ init _.py): def init_model(engine): """Call me before using any of the tables or classes in the model""" t_events = Table('events', Base.metadata, schema='events', autoload=True, autoload_with=engine) orm.mapper(Event, t_events) Session.configure(bind=engine) class Event(object): pass This works fine, but I would like to use declarative syntax: class Event(Base): __tablename__ =