FEAT: Explicit parameters and improved type hints for bulkcopy#420
Merged
bewithgaurav merged 7 commits intomainfrom Feb 6, 2026
Merged
FEAT: Explicit parameters and improved type hints for bulkcopy#420bewithgaurav merged 7 commits intomainfrom
bewithgaurav merged 7 commits intomainfrom
Conversation
…IDE discoverability - All options now explicit in function signature - Pass params directly to pycore (no kwargs dict conversion) - Matches mssql-tds explicit params API Based on community feedback from discussion #414
c90f0f1 to
fa2eab4
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors Cursor._bulkcopy to replace **kwargs bulk-copy options with an explicit, type-hinted parameter list and updated docstring.
Changes:
- Replaced
**kwargsin_bulkcopywith explicit parameters (e.g.,batch_size,timeout,column_mappings, and bulk-copy flags). - Expanded
_bulkcopydocstring to document supported bulk copy options. - Updated the
pycore_cursor.bulkcopy(...)invocation to pass the new explicit parameters.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📊 Code Coverage Report
Diff CoverageDiff: main...HEAD, staged and unstaged changesNo lines with coverage information in this diff. 📋 Files Needing Attention📉 Files with overall lowest coverage (click to expand)mssql_python.pybind.logger_bridge.hpp: 58.8%
mssql_python.pybind.logger_bridge.cpp: 59.2%
mssql_python.row.py: 66.2%
mssql_python.pybind.ddbc_bindings.cpp: 69.3%
mssql_python.pybind.ddbc_bindings.h: 69.7%
mssql_python.pybind.connection.connection.cpp: 75.3%
mssql_python.ddbc_bindings.py: 79.6%
mssql_python.pybind.connection.connection_pool.cpp: 79.6%
mssql_python.connection.py: 84.1%
mssql_python.cursor.py: 84.7%🔗 Quick Links
|
After Saurabh's review, Rust bulkcopy now uses direct types (bool, usize) instead of Option<T>. Python must not pass None values - instead omit the kwarg and let PyO3 use its defaults.
…/microsoft/mssql-python into bewithgaurav/fix-bulkcopy-kwargs
subrata-ms
reviewed
Feb 2, 2026
- batch_size: int = 0 (0 means server optimal) - timeout: int = 30 - column_mappings: Optional[Union[List[str], List[Tuple[int, str]]]] = None - All boolean flags: bool = False (not Optional[bool] = None) Updated docstring with two column_mappings formats: - Simple: List[str] - position = source index - Advanced: List[Tuple[int, str]] - explicit (index, column) mapping Simplified bulkcopy call to pass params directly (no kwargs dict) since Rust API now uses explicit defaults per Saurabh's review.
subrata-ms
approved these changes
Feb 6, 2026
Contributor
subrata-ms
left a comment
There was a problem hiding this comment.
approved with suggession
saurabh500
approved these changes
Feb 6, 2026
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
Implements Revision 2 of the BulkCopy API spec from community feedback in #414.
Replaces
**kwargswith explicit, type-hinted parameters for better IDE autocomplete and discoverabilityChanges
API Signature
What Changed
**kwargsOptional[bool] = Nonebool = Falsebatch_sizeOptional[int] = Noneint = 0(0 = server optimal)column_mappingsList[Tuple[Union[str, int], str]]Union[List[str], List[Tuple[int, str]]]Column Mappings
Per @amachanic's feedback, now supports simpler format:
Simple -
List[str]:Advanced -
List[Tuple[int, str]]: