FEAT: varbinarymax streaming support in execute() by gargsaumya · Pull Request #231 · microsoft/mssql-python
Work Item / Issue Reference
GitHub Issue: #<ISSUE_NUMBER>
Summary
This pull request adds support for streaming large binary parameters (bytes and bytearray) to SQL Server using VARBINARY(MAX), removing the previous limitation that prevented inserting binary data larger than 8192 bytes. The changes update both the Python and C++ layers to detect large binary parameters, use deferred execution (DAE) for streaming, and add new tests to verify correct handling of both small and large binary data.
Binary parameter streaming support:
- Updated
_map_sql_typeincursor.pyto detect largebytes/bytearrayparameters (>8000 bytes) and mark them for VARBINARY(MAX) streaming, while still handling small binaries directly. - Modified parameter binding in
ddbc_bindings.cppto use deferred execution for large binaries, and to allocate/bind buffers correctly for both small and large binary parameters. - Enhanced
SQLExecute_wrapinddbc_bindings.cppto stream large binary data usingSQLPutDatain chunks during execution.
Testing improvements: