FEAT: Explicit parameters and improved type hints for bulkcopy by bewithgaurav · Pull Request #420 · microsoft/mssql-python

@bewithgaurav

…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

Copilot AI review requested due to automatic review settings

January 30, 2026 12:40

@bewithgaurav

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.

@bewithgaurav

subrata-ms

@bewithgaurav

- 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.

@bewithgaurav bewithgaurav changed the title FEAT: Replace bulkcopy kwargs with explicit parameters FEAT: Explicit parameters and improved type hints for bulkcopy

Feb 2, 2026

@bewithgaurav

subrata-ms

saurabh500