Skip to content

Commit

Permalink
Merge pull request #29 from nrccua/ARCH-579-add-trusted_connection-to…
Browse files Browse the repository at this point in the history
…-pyodbc-options

Add pyodbc option Trusted_Connection & MultiSubnetFailover
  • Loading branch information
nrccua-timr authored Mar 23, 2021
2 parents 855bdb9 + cd9c70e commit 893d63b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
6 changes: 6 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ History
=======


v0.12.5 (2021-03-23)
-----------------------

* Add Trusted_Connection to pyodbc options.


v0.12.4 (2021-03-17)
-----------------------

Expand Down
8 changes: 8 additions & 0 deletions aioradio/pyodbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ async def establish_pyodbc_connection(
pwd: str,
port: int=None,
database: str='',
trusted_connection: str='',
multi_subnet_failover: str='',
driver: str='',
autocommit: bool=False
) -> pyodbc.Connection:
Expand All @@ -57,6 +59,8 @@ async def establish_pyodbc_connection(
pwd (str): password
port (int, optional): port. Defaults to None.
database (str, optional): database. Defaults to ''.
trusted_connection (str, optional): Trusted_Connection. Defaults to ''.
multi_subnet_failover (str, optional): MultiSubnetFailover. Defaults to ''.
driver (str, optional): unixodbc driver. Defaults to ''.
autocommit (bool, optional): autocommit. Defaults to False.
Expand All @@ -83,6 +87,10 @@ async def establish_pyodbc_connection(
conn_string += f';PORT={port}'
if database:
conn_string += f';DATABASE={database}'
if trusted_connection:
conn_string += f';Trusted_Connection={trusted_connection}'
if multi_subnet_failover:
conn_string += f';MultiSubnetFailover={multi_subnet_failover}'

return pyodbc.connect(conn_string, autocommit=autocommit)

Expand Down
3 changes: 2 additions & 1 deletion aioradio/tests/file_ingestion_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@ async def test_write_file_to_ftp(github_action, request):

conn.close()
assert file_attributes.file_size > 100000
now = time.time()
last_write_time = file_attributes.last_write_time
time.sleep(1)
now = time.time()
assert now > last_write_time and now - last_write_time < 10


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.12.4',
version='0.12.5',
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 893d63b

Please sign in to comment.