Re: [sqlalchemy] How can I handle 100 tables with same table structure in SQLAlchemy?

2012-10-22 Thread DoDo
Thanks. Michael! This works for me. DoDo Michael Bayer於 2012年10月21日星期日UTC+8下午11時41分06秒寫道: > > sure, you'd write a loop. I'm not sure if you're looking for core Table > objects or declarative classes, I'm guessing declarative classes: > > > from sqlalchemy.engine.reflection import Inspector > >

Re: [sqlalchemy] How can I handle 100 tables with same table structure in SQLAlchemy?

2012-10-21 Thread Michael Bayer
sure, you'd write a loop. I'm not sure if you're looking for core Table objects or declarative classes, I'm guessing declarative classes: from sqlalchemy.engine.reflection import Inspector insp = Inspector.from_engine(engine) class MyClass(Base): __abstract__ = True id = Column(Integ

[sqlalchemy] How can I handle 100 tables with same table structure in SQLAlchemy?

2012-10-21 Thread DoDo
Hello all, I encounter a situation that I have 100 tables in the same database but with same table structure. With SQLAlchemy, I need to copy 100 different class in order to adopt these tables. Is there any better way to do that? For example, I can use a general class to describe a table struct