Learn practical skills, build real-world projects, and advance your career


Created by catherinedevlin on Github, this enables the use of SQL magic functions that contain % and %% , allowing you to write SQL style code right in Jupyter Notebook.


Originally authored by Michael Bayer, sqlalchemy is touted as a “SQL toolkit and object-relational-mapper” for Python. For the purposes of this tutorial, it will mainly be used to store SQL queries into a pandas dataframe.


The third library depends on what SQL software you choose to use. For PostgreSQL, you would use psycopg2:

Different DBAPIs are documented on sqlalchemy’s website click, like MySQL, Oracle, and SQLite (thanks Dave Campbell).


!pip install ipython-sql --quiet
!pip install sqlalchemy --quiet
!pip install jovian --upgrade --quiet
!pip install psycopg2 --quiet
import pandas as pd
%load_ext sql
from sqlalchemy import create_engine