Skip to content

python: Use direct TLS connections for SQLAlchemy#168

Merged
danielfrankcom merged 1 commit intomainfrom
feat/native-direct-tls-sqlalchemy
May 30, 2025
Merged

python: Use direct TLS connections for SQLAlchemy#168
danielfrankcom merged 1 commit intomainfrom
feat/native-direct-tls-sqlalchemy

Conversation

@danielfrankcom
Copy link
Copy Markdown
Contributor

This PR modifies the SQLAlchemy sample to set sslnegotiation=direct as per #150.

It does this conditionally based on the underlying libpq version, since the same psycopg2 version can be used with multiple versions of libpq. I verified in the release notes here that sslnegotiation has been available since the 17.0 release and was not added as a minor version bump.

As with #167, at the time of writing, the psycopg2-binary package includes libpq 16.0, which doesn't support the sslnegotiation parameter. See the other PR for more detail, as the same applies here given SQLAlchemy's use of psycopg2 in this sample.

I added a section to the README.md file which describes more about the TLS configuration, and calls out that direct TLS connections are a new feature and may not be supported by all driver versions. This section was already reviewed in #160, and will be added to all samples which support direct TLS connections.

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT-0 license.

@danielfrankcom danielfrankcom requested a review from vic-tsang May 29, 2025 23:11
Copy link
Copy Markdown
Contributor

@leszek-bq leszek-bq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@danielfrankcom danielfrankcom merged commit 73a1a7f into main May 30, 2025
3 checks passed
@danielfrankcom danielfrankcom deleted the feat/native-direct-tls-sqlalchemy branch May 30, 2025 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants