import os
import psycopg2
import urlparse

urlparse.uses_netloc.append("postgres")
url = urlparse.urlparse(os.environ["DATABASE_URL"])

conn = psycopg2.connect(
    database=url.path[1:],
    user=url.username,
    password=url.password,
    host=url.hostname,
    port=url.port
)



cur = conn.cursor()

cur.execute("SELECT * FROM pitches LIMIT 10;")
print cur.fetchone()

cur.close()
conn.close()
Write script to connect to postgres
Write script to connect to postgres
