I am trying to create a connection to a Heroku PostgreSQL database via Python. I am using Windows10 with Python 3.6.8 and PostgreSQL 9.6.
I took this piece of code from "http://andyfiedler.com/2016/10/connecting-to-heroku-postgres-in-python"
import psycopg2
import subprocess
proc = subprocess.Popen('heroku config:get DATABASE_URL -a heroku_app', stdout=subprocess.PIPE, shell=True)
db_url = proc.stdout.read().decode('utf-8').strip() + '?sslmode=require'
heroku_conn = psycopg2.connect(db_url)
When I run that code, I get the error:
OperationalError: could not create SSL context: No such process
Searching around suggests that I need to install PostgreSQL with the "--with-openssl" option. Or, with SSL compiled in.
How do I do this in Windows10? Or, is there another way to get this to work? Thank you!