Код: Выделить всё
import psycopg2
con = psycopg2.connect(dbname='some_dbname', host='hostname.us-east-2.redshift.amazonaws.com', port='port#', user='username', password='password')
cursor=con.cursor()
query = "select * from table;"
cursor.execute(query)
data = np.array(cursor.fetchall())
cursor.close()
con.commit()
con.close()
Код: Выделить всё
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: could not connect to server: Connection timed out
Is the server running on host "hostname.us-east-2.redshift.amazonaws.com" and accepting
TCP/IP connections on port port#?
Подробнее здесь: https://stackoverflow.com/questions/461 ... 2-instance
Мобильная версия