credit to Dan Blanchard for psycopg2 binstar channel