Skip to main content


Showing posts with the label Restful

Python-Create a CRUD Restful Service API using FLASK and MYSQL

In this article,we will learn how to build Restful API with FLASK and MYSQL that have the capabilities to create, read, update, and delete data from the MYSQL database. Technologies used: Python 3Flask librarypymysql libraryflask-sqlalchemy libraryPlease go through the following steps in order to implement Python Restful API CRUD example using Flask and MySQL:
Step 1. Create MySQL database table – 'employee' with the following structure. CREATE TABLE IF NOT EXISTS `employee` (   `id` bigint(20) NOT NULL AUTO_INCREMENT,   `uname` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,   `email` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,   `salary` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,   PRIMARY KEY (`id`) ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2343 ;
Step 2. Create the below script(py is the extension to indicate Python script) where we import the flask module.
from flask import Flask
app = Flask(__name__)
Step 3.create the be…