PostgreSQL and Jupyter notebook

Franck Pachot
Apr 28 · 4 min read



%windir%\System32\cmd.exe "/K" C:\Users\Franck\Anaconda3\Scripts\activate.bat C:\Users\Franck\Anaconda3

IPython SQL

conda install -y -c conda-forge ipython-sql


conda install -y -c conda-forge postgresql
conda install -y -c anaconda psycopg2
conda install -y -c conda-forge pgspecial

Create a database

set PGDATA=C:\Anaconda\pgdata
mkdir %PGDATA%
pg_ctl initdb
pg_ctl start
psql -c "create database DEMO;" postgres

Jupyter Notebook

C:\Users\Franck\Anaconda3\python.exe C:\Users\Franck\Anaconda3\ C:\Users\Franck\Anaconda3 C:\Users\Franck\Anaconda3\python.exe C:\Users\Franck\Anaconda3\Scripts\ "C:\Anaconda/"
jupyter.exe notebook --notebook-dir=C:\Anaconda
%load_ext sql
%sql postgresql://localhost/demo
%sql select version()

GitHub Gist and Medium

Franck Pachot

Written by DBA at CERN, Oracle OCM 12c, Oracle ACE Director, Oak Table member. My 499 posts at dbi-services:

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade