Instantly share code, notes, and snippets.
Worked great for me. Thanks!!
I'm not an expert but why not just..
@alxvallejo; your commands would delete the tables with the data. @vkotovv gave an example of maintaining the tables while deleting their data.
this will only truncate the table or it will delete the tables also?
db.drop_all() == "DROP TABLE xx"
table.delete() == "TUNCTATE TABLE xx"
How to bypass IntegrityError when truncating data?
What is the type for the db object?
It depends. If using flask_sqlalchemy, then it is: <class 'flask_sqlalchemy.SQLAlchemy'>.