Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSL connection to Redshift using Psycopg2

I am trying to connect to a AWS Redshift server via SSL. I am using psycopg2 library in python to establish the connection and used sslmode='require' as a parameter in the connect line. Unfortunately i got this error:

sslmode value "require" invalid when SSL support is not compiled in

I read many other similar cases for PostgreSQL which mention the problem exists with the PostgeSQL version, but i didn't find any solutions for Redshift using Psycopg2. Do i need to install any specific SSL certificate for Redshift? If yes, how do i do it with Psycopg2? Any help will be appreciated.

like image 208
cppnoob Avatar asked Nov 09 '22 14:11

cppnoob


1 Answers

This worked for me: https://stackoverflow.com/a/36489939/101266

had this same error, which turned out to be because I was using the Anaconda version of psycopg2. To fix it, I had adapt VictorF's solution from here and run:

conda uninstall psycopg2
sudo ln -s /Users/YOURUSERNAME/anaconda/lib/libssl.1.0.0.dylib /usr/local/lib
sudo ln -s /Users/YOURUSERNAME/anaconda/lib/libcrypto.1.0.0.dylib /usr/local/lib
pip install psycopg2
like image 186
David Avatar answered Nov 14 '22 23:11

David