-
Notifications
You must be signed in to change notification settings - Fork 8
FEAT: macOS support #96
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
Conversation
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.
Pull Request Overview
This PR adds macOS support by streamlining the CI pipeline and introducing macOS‐specific logic for handling SQLWCHAR strings in the MSSQL Python bindings. Key changes include updating header and source files with macOS-specific string conversion helpers, implementing a platform-agnostic driver handle and function pointer retrieval, and simplifying the CI pipeline by removing redundant Windows jobs and unused steps.
Reviewed Changes
Copilot reviewed 4 out of 6 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
mssql_python/pybind/ddbc_bindings.h | Added macOS-specific headers, string conversion helper functions, and API changes. |
mssql_python/pybind/connection/connection.cpp | Introduced macOS-specific connection string handling using a local buffer. |
mssql_python/pybind/CMakeLists.txt | Updated the source file selection and removed the /WX flag from MSVC build options. |
eng/pipelines/pr-validation-pipeline.yml | Removed unnecessary Windows-specific jobs and commented code for a streamlined macOS job. |
Comments suppressed due to low confidence (1)
eng/pipelines/pr-validation-pipeline.yml:9
- Review and remove any obsolete commented-out steps and jobs from the pipeline configuration to reduce noise and potential confusion.
jobs:
mssql_python/pybind/CMakeLists.txt
Outdated
# if(APPLE) | ||
# set(DDBC_SOURCE "ddbc_bindings_mac.cpp") | ||
# message(STATUS "Using macOS-specific source file: ${DDBC_SOURCE}") | ||
# # Only ddbc_bindings_mac.cpp is used on macOS | ||
# # TODO: Implement smart pointer in macOS | ||
# add_library(ddbc_bindings MODULE ${DDBC_SOURCE}) | ||
# else() | ||
# This is just windows block | ||
set(DDBC_SOURCE "ddbc_bindings.cpp") | ||
message(STATUS "Using standard source file: ${DDBC_SOURCE}") | ||
# Include connection module for Windows | ||
add_library(ddbc_bindings MODULE ${DDBC_SOURCE} connection/connection.cpp connection/connection_pool.cpp) | ||
endif() | ||
set(DDBC_SOURCE "ddbc_bindings.cpp") | ||
message(STATUS "Using standard source file: ${DDBC_SOURCE}") | ||
# Include connection module for Windows | ||
add_library(ddbc_bindings MODULE ${DDBC_SOURCE} connection/connection.cpp connection/connection_pool.cpp) | ||
# endif() |
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.
Consider removing the commented-out macOS-specific source file block if it is no longer needed to improve clarity and maintainability.
Copilot uses AI. Check for mistakes.
1d8dc8c
to
34bd339
Compare
9c3a89c
to
bd8b56c
Compare
8072499
to
6380f4a
Compare
fs::path primaryPath = fs::path(moduleDir) / "libs" / "macos" / runtimeArch / "lib" / "libmsodbcsql.18.dylib"; | ||
if (fs::exists(primaryPath)) { | ||
driverPath = primaryPath; | ||
LOG("macOS driver found at: {}", driverPath.string()); |
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.
I am facing an issue w.r.t stdout logs while running main.py normally, if you see main.py sends out all these logs from ddbc bindings to stdout
I noticed that these logs are not showing up while we run main, actually raising this since I'm working on top of this branch for linux and got an issue with logs even in linux. checked macOS logs in latest pipeline run of this branch, and looks like they're not there - https://sqlclientdrivers.visualstudio.com/public/_build/results?buildId=118869&view=logs&j=bee890e9-c040-5cc9-d6a5-bdcb2ba73021&t=e9a69565-b417-5aac-952f-906672102243
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.
Have you tried printing these directly to stdout. I have seen this issue with logger since quite sometime now, even on windows and I think we also have a work item related to this.
merging main here for comparison purposes with the linux PR #110 |
This pull request includes significant changes to streamline the pipeline configuration and implement macOS-specific functionality for the MSSQL Python bindings. The most important changes involve removing redundant pipeline jobs, adding macOS-specific logic for handling SQLWCHAR strings, and introducing platform-agnostic code for driver handling.
Pipeline Configuration Updates:
PytestOnWindows
job and its associated steps, including Python installation, LocalDB setup, test execution, and artifact publishing. This simplifies the pipeline and reduces redundancy.macOS-Specific Enhancements:
connection.cpp
, including buffer creation and null-termination to ensure compatibility with the ODBC driver.ddbc_bindings.h
. These changes address differences in Unicode encoding between macOS and other platforms. [1] [2]Platform-Agnostic Improvements:
DriverHandle
) and implemented a cross-platform function (GetFunctionPointer
) to resolve function pointers from libraries. This ensures compatibility across Windows and macOS.CMakeLists.txt
file to comment out the macOS-specific source file block, indicating that only the standard source file is currently used.Miscellaneous Updates:
/WX
option, which treats warnings as errors, to avoid build failures during development.Checklist