Hello,
I'm trying to get psycopg2 to connect to my database. This is what my call to psycopg2.connect looks like:
connectstring = "postgresql://[USER]:[PASSWORD]@eu-central-1.aws.neon.tech/[DB]"
url = up.urlparse(connectstring)
params = {'sslmode': 'require', 'options': 'endpoint=[ENDPOINT]'}
connection = psycopg2.connect(
database=url.path[1:],
user=url.username,
password=url.password,
host=url.hostname,
port=url.port,
**params
)
The error I'm getting is:
psycopg2.OperationalError: connection to server at "eu-central-1.aws.neon.tech" ([IP]), port 5432 failed: ERROR: Common name inferred from SNI ('aws.neon.tech') is not known.
I am able to connect to psql using the connection string (including the query parameters) but I'm not sure why psycopg2 won't connect.