-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to use dialect mssql+pyodbc #298
base: main
Are you sure you want to change the base?
Allow to use dialect mssql+pyodbc #298
Conversation
if len(drivers) > 0: | ||
driver_str = drivers[0].replace(" ", "+") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My hunch is that this won't work because sorted
is an iterable that can't be indexed. We likely also need to parse the version as an integer because, using string comparison, version 8 is greater than version 10. E.g.,
>>> max(['ODBC Driver 10 for SQL Server', 'ODBC Driver 8 for SQL Server'])
'ODBC Driver 8 for SQL Server'
...and verify that version sorting does not work correctly.
|
||
r = re.compile(r"ODBC Driver \d{1,2} for SQL Server") | ||
# We sort drivers in reversed order to get the latest | ||
drivers = sorted(list(filter(r.match, pyodbc.drivers())), reverse=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll have to convert to int
first. We can probably just use max
here rather than sorting and taking the first.
The test fails because |
Closes #244