[python]Flask Migrate

Flask Migrate advantage This is for easy update of the existing database, such as create a new column, create a new table, drop a table, revert previous database. With migrate, I do not need to do the db.create_all() anymore. A note on sqlite3, once a table is created you cannot insert column directly, need to … Continue reading [python]Flask Migrate

Advertisements

[python] Create database with flask-sqlalchemy

On previous post I have used a pure SQLAlchemy module to just create the database, this time I am using Flask_SQLAlchemy to do it, which makes the creation simpler. I will need to put in two configuration parameters: SQLALCHEMY_DATABASE_URI SQLALCHEMY_TRACK_MODIFICATIONS For the configuration I have put them in a config.py file. As usual you need … Continue reading [python] Create database with flask-sqlalchemy

[python]Create database with SQLAlchemy

The objective of learning SQLAlchemy is to use its Object Relational Mapper (ORM), this allows programmer who does not do SQL syntax to also do CRUD on supported database, the ORM does the "translation or mapping" for us in the background, in our code we only need to do CRUD with python syntax. The SQLAlchemy … Continue reading [python]Create database with SQLAlchemy