In [1]:
#https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-16-04
#https://www.fullstackpython.com/blog/postgresql-python-3-psycopg2-ubuntu-1604.html
#http://initd.org/psycopg/docs/usage.html

import psycopg2

In [2]:
connect_str = "dbname='capstone' user='pipe' host='localhost' password='pipesql'"
conn = psycopg2.connect(connect_str)

In [3]:
cursor = conn.cursor()
cursor.execute("SELECT * from playground")
rows = cursor.fetchall()

In [4]:
rows


Out[4]:
[(1, 'slide', 'blue', 'south', datetime.date(2014, 4, 28)),
 (2, 'swing', 'yellow', 'northwest', datetime.date(2010, 8, 16))]

In [ ]: