just build a function: def create_my_class(x, y, z, ...): class MyClass(Base): __tablename__ = '...' # ...
MyClass.__name__ = 'SomeName%s%s' % (q, p) return MyClass On Jul 25, 2012, at 5:49 AM, Stephan Hügel wrote: > I need to create 20 identical (in structure) tables, each of which will have > a many-to-many relationship with a particular table (Table_A). > > I've thought a bit about this, and there doesn't seem to be a better way to > structure the setup; it's a canonical reference (Table_A), each entry of > which can have multiple overlapping entries in a particular book (each of the > 20 tables represents references in a particular book). > Is there a sensible, compact way for me to instantiate the 20 classes and > association tables? Their structure is extremely simple; just a primary key > column and a string column. > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/sqlalchemy/-/fVKaMEuyN_IJ. > To post to this group, send email to sqlalchemy@googlegroups.com. > To unsubscribe from this group, send email to > sqlalchemy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.