Before running this notebook, run:
pip3 install jupyter SQLAlchemy psycopg2
This will install the notebook server and database drivers needed to run these examples. For more information on installing Jupyter (formerly IPython notebook) see their install guide.
Once you've installed the dependencies, run jupyter notebook
and it will open your web browser to the notebook's main page. Then upload this notebook (SQLTest.ipynb) and run it.
http://www.stickpeople.com/projects/python/win-psycopg/ - this solution worked for me.