+# A list of all table classes will live in table_classes
+table_classes = []
+
+class TableMetaclass(DeclarativeMeta):
+ def __init__(cls, name, bases, attrs):
+ super(TableMetaclass, cls).__init__(name, bases, attrs)
+ if hasattr(cls, '__tablename__'):
+ table_classes.append(cls)
+