Re: [sqlalchemy] Setting __tablename__ at runtime?

2015-08-19 Thread Frank Horowitz
On Wednesday, August 19, 2015 at 1:24:08 AM UTC-4, Michael Bayer wrote: it doesn't work that way. The tables in your schema are supposed to be fixed. If you want to map a new class to a new table, you can do that with mixins: class Level(object): id = Column(Integer,

Re: [sqlalchemy] Setting __tablename__ at runtime?

2015-08-19 Thread jkmacc
On Tuesday, August 18, 2015 at 11:24:08 PM UTC-6, Michael Bayer wrote: On 8/18/15 8:57 PM, Frank Horowitz wrote: Hi All, A noob question, that I've been struggling with off and on for a while. I'm pretty sure that I'm missing something obvious... I'm creating tables and their entries

[sqlalchemy] copy the scheme of a table

2015-08-19 Thread c.buhtz
I tried a little bit around and checked the docs of course. Is there a way to just copy the column-definitions of one table to another? class Model(Base): __tablename__ = 'Model' oid = Column(Integer, primary_key=True) data = Column(String) AnotherModel = Table('AnotherModel',