I have created a cluster in redshift and I am trying to connect to the cluster via python psycopg ... I am able to connect through sqlworkbench/j using jdbc driver but I am unable to do so in python. Here is my code
import psycopg2
import os
# Redshift Server Details
dsn_database = "dev"
dsn_hostname = "redshift-cluster-1.cdd5oumaebpd.ap-south-1.redshift.amazonaws.com:5439/dev"
dsn_port = "5439"
dsn_uid = "*****"
dsn_pwd = "*****"
con=psycopg2.connect(dbname= dsn_database, host=dsn_hostname,
port= dsn_port, user= dsn_uid, password= dsn_pwd)
I am getting the following error: sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) could not translate host name "host.amazonaws.com" to address: Unknown host
Please help!
dsn_hostname
isn't actually a hostname, it's a connection string. – Parsifal