Flask-SQLAlchemy\'s db.create_all()
method creates each table corresponding to my defined models. I never instantiate or register instances of the models. They
You need to call create_all()
in the same module as all the models are in. If they are in separate modules, you need to import them all before calling create_all()
. SQLAlchemy looks at what models have been subclassed from db.Model
, and it will only see models that have been imported. It will create the corresponding table for each model. Also explained here.