id go old school and just use a callable: def log_table(name, metadata): return Table(name, metadata, Column('log_id', Integer, primary_key=True), Column(...) )
the Table object is unique per name, so if you call Table twice for the same name/metadata combination, you get the same instance. so its safe to substitute the log_table() function freely. Achim Domma wrote: > Hi, > > I have a database with multiple logging tables, which have all the same > structure. I want to write a pylons app to display logging records from > different tables. The table to be displayed should be selectable from a > drop down box. How do I solve this using SQLAlchemy? > > I assume that I need only one definition of the table schema. But I have > no idea how and at what point in time I could/should change the table > name in the schema. > > Any hint how to approach this use case in SA? > > regards, > Achim > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Sqlalchemy-users mailing list > Sqlalchemy-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users > ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users