def db(app, _create_db): with app.app_context(): slq_alchemy_db.create_all() slq_alchemy_db.session.commit() yield slq_alchemy_db slq_alchemy_db.session.rollback() with app.app_context(): slq_alchemy_db.drop_all()
def db_session(app): db.create_all() yield db.session db.drop_all()
def create_table(): db.create_all()
def create_db(): """este comando inicializa banco de dados""" db.create_all()