Skip to content

Commit

Permalink
adding TDS logging config setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Clarke committed Sep 3, 2024
1 parent 19a4d22 commit d051c4a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
names with double quotes. Issue #74
* Providing more flexibility with database connections to support newer
SQL Server instances like PDW via option conn_properties config. Issue #28
* Provides the ability to dump TDS logs via new enable_tds_logging config.

# tap-mssql 2.5.0 2024-08-26

Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,18 @@ Example: override the built-in session properties supplied by pymssql by default
}
```

Optional:

The `"enable_tds_logging"` When set it will dump out the underlying TDS driver logs. Useful for diagnosing issues if you are having connection issues to SQL Server databases. WARNING! this
does dump a lot of information and may log secure data, should be only used in Development
environments.

```json
{
"enable_tds_logging": true
}
```

These are the same basic configuration properties used by the mssql command-line
client (`mssql`).

Expand Down
4 changes: 4 additions & 0 deletions tap_mssql/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import backoff
import pymssql
import singer
from os import environ

LOGGER = singer.get_logger()

Expand Down Expand Up @@ -38,6 +39,9 @@ def __init__(self, config):
# Add additional conn_properties for specific version settings
if config.get("conn_properties"):
args["conn_properties"] = config.get("conn_properties")
# Optional ability to dump TDS logs
if config.get("enable_tds_logging"):
environ['TDSDUMP'] = 'stderr'
conn = pymssql._mssql.connect(**args)
super().__init__(conn, False, True)

Expand Down

0 comments on commit d051c4a

Please sign in to comment.