Skip to content

Commit

Permalink
Support older versions of Sybase via TDS version 4.2 (#25)
Browse files Browse the repository at this point in the history
* Bumping pymssql version to examine driver issue

* Trying TDS 4.2 if there is a connection error. This feature is for older versions of Sybase.

* Setting TDS version as a string.

* Bumping Version
  • Loading branch information
s7clarke10 authored Dec 1, 2024
1 parent 783c67a commit 40953cc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Changelog
## 1.1.0
* Downgrading FreeTDS version if connection fails for older versions of Sybase.
## 1.0.13
* Using correct format sybase time datatype
- https://github.com/s7clarke10/tap-sybase/pull/28
Expand Down
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setup(
name="tap-sybase",
version="1.0.13",
version="1.1.0",
description="Singer.io tap for extracting data from SQL Server - PipelineWise compatible",
author="Stitch",
url="https://github.com/s7clarke10/tap-sybase",
Expand All @@ -17,8 +17,7 @@
"attrs>=24.2.0",
"pendulum>=1.2.0",
"realit-singer-python>=5.0.0",
# pymssql==2.2.8 broken: https://github.com/pymssql/pymssql/issues/833
"pymssql>=2.1.4,!=2.2.8",
"pymssql>=2.2.9",
"backoff>=1.8.0",
],
entry_points="""
Expand Down
13 changes: 11 additions & 2 deletions tap_sybase/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import backoff

import pymssql
from pymssql._mssql import MSSQLDatabaseException

import singer
import ssl
Expand Down Expand Up @@ -39,8 +40,16 @@ def __init__(self, config):
"tds_version": config.get("tds_version", None),
"conn_properties": '',
}
conn = pymssql._mssql.connect(**args)
super().__init__(conn, False, True)

try:
conn = pymssql._mssql.connect(**args)
super().__init__(conn, False, True)
except:
# Set TDS version to lower version supporting older versions of Sybase
# Older versions of Sybase to not support certain keywords like AS
args["tds_version"] = "4.2"
conn = pymssql._mssql.connect(**args)
super().__init__(conn, False, True)

def __enter__(self):
return self
Expand Down

0 comments on commit 40953cc

Please sign in to comment.