FEAT: varcharmax streaming support in execute#206
Merged
gargsaumya merged 15 commits intomainfrom Sep 2, 2025
Merged
Conversation
8e53235 to
48338d6
Compare
644c517 to
786ebef
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the MSSQL Python driver by adding support for VARCHAR(MAX) streaming through data-at-execution (DAE) and improving type safety for parameter binding. The changes focus on robust handling of large string parameters and preventing silent type mismatches.
Key changes:
- Added DAE streaming support for both SQL_C_CHAR and SQL_C_WCHAR parameter types with chunked data transmission
- Enhanced type validation in parameter binding to raise explicit errors for unsupported types
- Added comprehensive test coverage for VARCHAR(MAX) and NVARCHAR(MAX) operations in both LOB and non-LOB scenarios
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| mssql_python/pybind/ddbc_bindings.cpp | Implements DAE streaming logic for string parameters and adds type validation for SQL_C_CHAR and SQL_C_BINARY bindings |
| tests/test_004_cursor.py | Adds test cases for VARCHAR(MAX) and NVARCHAR(MAX) insert operations covering both small and large data scenarios |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
sumitmsft
requested changes
Sep 1, 2025
581b297 to
72c6a18
Compare
sumitmsft
approved these changes
Sep 1, 2025
bewithgaurav
approved these changes
Sep 2, 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 focuses on improving type safety and error handling for parameter binding and execution in the MSSQL Python driver, especially for string and binary types. The changes ensure that only supported Python types are bound to SQL parameters and that errors are raised for unsupported types, preventing silent failures. Additionally, the data-at-execution (DAE) streaming path for strings is now more robust and explicit.
Parameter type safety and error handling:
_map_sql_typeincursor.pyto raise aTypeErrorfor unsupported parameter types instead of defaulting toSQL_VARCHAR, preventing silent type mismatches.ddbc_bindings.cpp, added explicit type checks forSQL_C_CHARandSQL_C_BINARYbindings, raising an error if the Python object is not a string or bytes-like object.DAE (Data At Execution) streaming improvements:
SQL_C_CHARinddbc_bindings.cppto handle string parameters more robustly, including chunked streaming viaSQLPutData.strobjects mapped toSQL_C_CHAR, ensuring large strings are sent in manageable pieces.Platform-specific encoding for wide strings:
SQL_C_WCHAR) parameters are correctly converted to the platform-specific encoding before streaming.