[python]Query object from table with Flask SQLAlchemy

The purpose of using SQLAlchemy is to avoid using SQL syntax, and Flask's extension of SQLAlchemy makes usage easier than the original SQLAlchemy. So here are two demonstrations to query every row and query one row with a condition.

[python] Flask SQLAlchemy insert data

On previous post it was demonstrated that creating database is easier with Flask SQLAlchemy than using SQLAlchemy itself. This post demonstrates how data can be inserted to existing database, and also to check if the tables exist before executing create_all(). create_all() does not re-create table if the table exists, the if statement is to demonstrate … Continue reading [python] Flask SQLAlchemy insert data

[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]Deploy flask api with gunicorn and nginx

NGINX is a load balancer and a reverse proxy, the purpose is to interface between user and WSGI server. Web server cannot directly interact with Flask like php, to use the Flask web application a WSGI server is required, in this case Gunicorn is a WSGI server. Gunicorn will run the python flask application and … Continue reading [python]Deploy flask api with gunicorn and nginx

[python]Simple web application for storing contacts

Introduction This is a practice mini project for me to get hold of API, sqlite3 and regex. The objective is to capture contact information and store into a sqlite3 database file - contacts.db. This is not a full fledged web application for storing contacts however can be used as a based for additional features. Information … Continue reading [python]Simple web application for storing contacts