REFACTOR: Shift get_driver_path from Python to DDBC bindings with tests#168
Merged
bewithgaurav merged 7 commits intomainfrom Aug 6, 2025
Merged
REFACTOR: Shift get_driver_path from Python to DDBC bindings with tests#168bewithgaurav merged 7 commits intomainfrom
get_driver_path from Python to DDBC bindings with tests#168bewithgaurav merged 7 commits intomainfrom
Conversation
get_driver_path from Python to DDBC bindingsget_driver_path from Python to DDBC bindings with tests
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request refactors ODBC driver path resolution from Python to C++ to eliminate circular import issues on Alpine Linux caused by musl libc's stricter dynamic loading rules.
- Removed the Python
get_driver_pathfunction fromhelpers.pyand implemented equivalent logic in C++ (GetDriverPathCpp) - Updated C++ bindings to use the new C++ implementation instead of calling Python helpers during module initialization
- Modified test suite to validate the new C++ driver path resolution against expected paths
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| mssql_python/helpers.py | Removed the Python get_driver_path function |
| mssql_python/pybind/ddbc_bindings.cpp | Added C++ GetDriverPathCpp implementation and updated module bindings |
| tests/test_000_dependencies.py | Replaced Python helper test with C++ function validation test |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…b.com/microsoft/mssql-python into bewithgaurav/refactor_get_driver_path
jahnvi480
approved these changes
Aug 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Work Item / Issue Reference
Summary
This pull request refactors the ODBC driver path resolution logic to be implemented entirely in C++ instead of Python. The main motivation is to eliminate a circular import issue that caused failures on Alpine Linux due to musl libc's stricter dynamic loading rules. The Python helper and its associated test have been removed, and equivalent logic is now handled in C++. The test suite has been updated to validate the new C++-based resolution.
Refactor: Move driver path resolution to C++
get_driver_pathfunction frommssql_python/helpers.py, eliminating Python-based driver path resolution.GetDriverPathCppinmssql_python/pybind/ddbc_bindings.cppto handle all platform and architecture-specific ODBC driver path resolution in C++. This avoids Python dependencies during module initialization and resolves the Alpine Linux circular import issue. [1] [2]GetDriverPathCppinstead of the removed Python function.Testing updates
GetDriverPathCppfunction against expected driver paths derived in Python. [1] [2]