Skip to content

FEAT: Make _bulkcopy a public API#449

Merged
subrata-ms merged 1 commit intomainfrom
dev/saurabh/publicapi
Feb 25, 2026
Merged

FEAT: Make _bulkcopy a public API#449
subrata-ms merged 1 commit intomainfrom
dev/saurabh/publicapi

Conversation

@saurabh500
Copy link
Contributor

@saurabh500 saurabh500 commented Feb 25, 2026

…or missing mssql_py_core

Work Item / Issue Reference

GitHub Issue: #448


Summary

This change renames _bulkcopy to bulkcopy to make the feature available in the public API surface area.

@saurabh500 saurabh500 marked this pull request as ready for review February 25, 2026 06:12
Copilot AI review requested due to automatic review settings February 25, 2026 06:12
@github-actions github-actions bot added the pr-size: small Minimal code update label Feb 25, 2026
Copy link
Contributor

Copilot AI left a 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 promotes the cursor bulk copy helper from a private method (_bulkcopy) to a public API (bulkcopy), aligning the test suite with the new method name and adjusting the runtime error messaging when the native mssql_py_core dependency is unavailable.

Changes:

  • Renamed Cursor._bulkcopy(...) to Cursor.bulkcopy(...) to expose bulk copy as a public API.
  • Updated the bulkcopy integration test to call cursor.bulkcopy(...).
  • Updated the ImportError message shown when mssql_py_core cannot be imported.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/test_019_bulkcopy.py Updates test to use the new public cursor.bulkcopy() API.
mssql_python/cursor.py Renames the method to bulkcopy() and changes the ImportError message for missing/unloadable mssql_py_core.
Comments suppressed due to low confidence (1)

mssql_python/cursor.py:2515

  • bulkcopy is now part of the public Cursor API, but it’s still excluded from coverage via # pragma: no cover. Since there’s an integration test module for bulkcopy, consider removing the pragma (or narrowing the exclusion to only the truly untestable branches) so coverage will catch regressions in this public method.
    def bulkcopy(
        self,
        table_name: str,
        data: Iterable[Union[Tuple, List]],
        batch_size: int = 0,
        timeout: int = 30,
        column_mappings: Optional[Union[List[str], List[Tuple[int, str]]]] = None,
        keep_identity: bool = False,
        check_constraints: bool = False,
        table_lock: bool = False,
        keep_nulls: bool = False,
        fire_triggers: bool = False,
        use_internal_transaction: bool = False,
    ):  # pragma: no cover

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link

📊 Code Coverage Report

🔥 Diff Coverage

100%


🎯 Overall Coverage

76%


📈 Total Lines Covered: 5520 out of 7185
📁 Project: mssql-python


Diff Coverage

Diff: main...HEAD, staged and unstaged changes

No 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.4%
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.cursor.py: 84.7%
mssql_python.__init__.py: 84.9%

🔗 Quick Links

⚙️ Build Summary 📋 Coverage Details

View Azure DevOps Build

Browse Full Coverage Report

@subrata-ms subrata-ms merged commit 0242a91 into main Feb 25, 2026
38 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-size: small Minimal code update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants