Skip to content

fix: correct pymssql connection encryption parameter - #43

Open
albertoleonor wants to merge 1 commit into
RichardHan:mainfrom
albertoleonor:fix/pymssql-encryption-param
Open

fix: correct pymssql connection encryption parameter#43
albertoleonor wants to merge 1 commit into
RichardHan:mainfrom
albertoleonor:fix/pymssql-encryption-param

Conversation

@albertoleonor

Copy link
Copy Markdown

Summary

Fixes an issue where setting MSSQL_ENCRYPT to "true" (or automatic Azure SQL detection) fails with a connection error:
TypeError: connect() got an unexpected keyword argument 'encrypt'

Details

  • pymssql does not support the encrypt keyword parameter in connect(), nor does it support connection string options appended to the host/server string (which causes FreeTDS to fail hostname resolution).
  • The correct parameter supported by pymssql (version 2.2.8+) is encryption, which accepts string values: 'off', 'request', or 'require'.
  • This PR replaces the encrypt setting and server string appending with the correct encryption parameter (setting it to 'require' when encryption is desired and 'off' otherwise).
  • Unit tests in tests/test_config.py have been updated to reflect the new encryption parameter format.

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.

1 participant