My company recently changed our Redshift cluster and now they require an SSL connection. In the past I've connected Python/pandas to Redshift via the method I've detailed here: http://measureallthethin.gs/blog/connect-python-and-pandas-to-redshift/
From the SQLAlchemy documentation, looks like all I need to do is add connect_args={'sslmode':'require'}
to the create_engine()
call, as this thread pointed out: How do I connect to Postgresql using SSL from SqlAchemy+pg8000?
However, I now get this error:
OperationalError: (psycopg2.OperationalError) sslmode value "require" invalid when SSL support is not compiled in
I use the Anaconda distribution for a number of packages, and found I needed to update my psycopg2 package per these instructions: https://groups.google.com/a/continuum.io/d/msg/conda/Fqv93VKQXAc/mHqfNK8xZWsJ
However, even after updating psycopg2 I'm still getting the same error and am at a loss at this point on how to further debug. I'd like to figure this out so I can get our Redshift data directly into pandas.
AWS has developed an Amazon Redshift connector for Python (here is the GitHub repo) that helps in the process.
In order to install it on may install from the source
Or from the binary using PyPi
Or Conda
Here is an example
Note that one of the Connection Parameters one can pass is SSL (If SSL is enabled). The default value is
TRUE
.