I just wanted to know if there is a way to delete or modify a table from flask-sqlalchemy.
I am working on a flask web app for my final project (second time using flask). I just (1 month ago) switched to flask sqlalchemy as my project is on Heroku I had to connect my table to Heroku PostgreSQL. I made a flask-sqlalchemy table and created it using the db.create_all()
command now for my app to fulfil its purpose it is of utmost importance to save images, the best way of which I found to be to add them to the database. Now I want to change the particular table class to store a column called image as image = db.Column(db.Text, nullable=False)
but I can not. It remains the former and gives me an error signifying that the column image
does not exist every time I try to access or add something to the table. Any intention or will to help is appreciated.
CodePudding user response:
You can use drop()
from sqlalchemy import create_engine
engine = create_engine("...")
my_table.__table__.drop(engine)