Skip to content

Connecting Python to MySQL

Damodar Dahal edited this page Mar 24, 2018 · 1 revision

We'll be using a Python package(library) named SQLAlchemy in order to communicate between Python and MySQL.

SQLAlchemy

We are going to use SQLAlchemy to enable communication between Python (Flask) Web Server and MySQL server. SQLAlchemy is a Object-Relational Mapping (ORM) library for Python that can be used to avoid the errors that can appear while using raw SQL. Even though it provides us functions as abstraction layers, it still uses SQL queries on a low level basis.

SQLAlchemy API

  • Object Relational Tutorial: Equivalents between SQL and SQLAlchemy.
  • Query API: Further description of the Query API. Study this guide if you want to perform SQL joins and other complicated queries.

Clone this wiki locally