aws / amazon-redshift-python-driver

Redshift Python Connector. It supports Python Database API Specification v2.0.
Apache License 2.0
202 stars 72 forks source link

Deprecation version on Python 3.11: ssl.SSLContext() without protocol argument is deprecated #196

Closed ad-m-ss closed 6 months ago

ad-m-ss commented 7 months ago

Driver version

master

Redshift version

N/A

Client Operating System

N/A

Python version

3.11

Table schema

N/A

Problem description

  1. Expected behaviour:
  2. Actual behaviour:
  3. Error message/stack trace:
/usr/local/lib/python3.11/site-packages/redshift_connector/__init__.py:340: in connect
    return Connection(
/usr/local/lib/python3.11/site-packages/redshift_connector/core.py:603: in __init__
    ssl_context: SSLContext = SSLContext()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class 'ssl.SSLContext'>, protocol = None, args = (), kwargs = {}

    def __new__(cls, protocol=None, *args, **kwargs):
        if protocol is None:
>           warnings.warn(
                "ssl.SSLContext() without protocol argument is deprecated.",
                category=DeprecationWarning,
                stacklevel=2
            )
E           DeprecationWarning: ssl.SSLContext() without protocol argument is deprecated.
  1. Any other details that can be helpful:

https://github.com/aws/amazon-redshift-python-driver/blob/62a4d4e364055e3d3d6c0d334258ca556298a9b8/redshift_connector/core.py#L654

Python Driver trace logs

Reproduction code

Brooke-white commented 7 months ago

Hi @ad-m-ss, thank you for identifying this deprecation warning. We plan to include resolution for it in our December release of redshift-connector.

ad-m-ss commented 7 months ago

Sounds good. Thanks for your work here!

Additional information:

Suggestion:

Brooke-white commented 6 months ago

Hi @ad-m-ss , a fix can be found in 2.0.918. The team will work to address blocking on warnings in CI.