In a flask application I create my schema with
db.create_all()
some of the tables should not be created, they are managed externally to the application, how can I tell SqlAlchemy to not create them ?
In a flask application I create my schema with
db.create_all()
some of the tables should not be created, they are managed externally to the application, how can I tell SqlAlchemy to not create them ?
The command db.create_all()
will only create models for those classes that you import into the script you use to run that command. For example, lets say that my models.py
file has two classes:
class User(db.Model):
and
class Address(db.Model):
In the script where I run db.create_all
, if my file looks like:
from models import User
db.create_all()
my app will only create the User model. Conversely, if my file looks like:
from models import User, Address
db.create_all()
both the User
and Address
models will be created.