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

ipython-sql

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.

sqlalchemy

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.

psycopg2

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).

https://medium.com/analytics-vidhya/postgresql-integration-with-jupyter-notebook-deb97579a38d

!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