Skip to content

Commit

Permalink
Add TrustServerCertificate option in sqlserver connection string
Browse files Browse the repository at this point in the history
  • Loading branch information
nrccua-timr committed Oct 20, 2023
1 parent 24ce93e commit 45ff8cb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ History
=======


v0.19.3 (2023-10-20)

* Add TrustServerCertificate option in sqlserver connection string, enabling use of driver {ODBC Driver 18 for SQL Server}.


v0.19.2 (2023-10-19)

* Add new DB_CONNECT class that uses env vars instead of AWS secret manager for sensitive creds.
Expand Down
4 changes: 4 additions & 0 deletions aioradio/pyodbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def establish_pyodbc_connection(
database: str='',
tds_version: str='7.4',
trusted_connection: str='',
trust_server_certificate: str='',
multi_subnet_failover: str='',
driver: str='',
application_intent: str='',
Expand All @@ -65,6 +66,7 @@ def establish_pyodbc_connection(
database (str, optional): database. Defaults to ''.
tds_version (str, optional): TDS_Version. Defaults to '7.4'.
trusted_connection (str, optional): Trusted_Connection. Defaults to ''.
trust_server_certificate (str, optional): TrustServerCertificate. Defaults to ''.
multi_subnet_failover (str, optional): MultiSubnetFailover. Defaults to ''.
driver (str, optional): unixodbc driver. Defaults to ''.
application_intent (str, optional): ReadOnly | ReadWrite. Defaults to ''.
Expand Down Expand Up @@ -98,6 +100,8 @@ def establish_pyodbc_connection(
conn_string += f';MultiSubnetFailover={multi_subnet_failover}'
if application_intent:
conn_string += f';ApplicationIntent={application_intent}'
if trust_server_certificate:
conn_string += f';TrustServerCertificate={trust_server_certificate}'

return pyodbc.connect(conn_string, autocommit=autocommit)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
long_description = fileobj.read()

setup(name='aioradio',
version='0.19.2',
version='0.19.3',
description='Generic asynchronous i/o python utilities for AWS services (SQS, S3, DynamoDB, Secrets Manager), Redis, MSSQL (pyodbc), JIRA and more',
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 45ff8cb

Please sign in to comment.