#!/usr/bin/env python2 from __future__ import print_function import psycopg2 conn = psycopg2.connect(user='postgres') cur = conn.cursor() cur.execute('select * from test') print(cur.fetchall())