I define a lot of model classes using peewee. ClassName.create_table() can generate the table,but only one table. How could I create all tables using a single state
ClassName.create_table()
This snipnet will create all tables which objects are defined in the current module:
import sys for cls in sys.modules[__name__].__dict__.values(): try: if BaseModel in cls.__bases__: cls.create_table() except: pass