Dilli Dilli - 9 months ago 62
Python Question

Dropping Flask-SQLAlchemy table raises AttributeError

I'm trying to drop a table on my database, but I get the following error:

AttributeError: 'SQLAlchemy' object has no attribute '_run_visitor'

How do I drop a Flask-SQLAlchemy model's table?

db = SQLAlchemy(app)

class DeleteTable(Resource):
def get(self):

class CardsDB(db.Model):
__tablename__ = 'Cards'
id = db.Column(db.Integer, primary_key=True)
viewID = db.Column(db.Integer, db.ForeignKey('Views.id'))


Answer Source

drop takes an engine, not a Flask-SQLAlchemy extension object.