Skip to content

Conversation

@subrata-ms
Copy link
Contributor

@subrata-ms subrata-ms commented Jan 14, 2026

AB#41033

GitHub Issue: #<ISSUE_NUMBER>


Summary

This pull request introduces a new method to the cursor.py file that enables efficient bulk copy operations using a Rust-based implementation. The main addition is the _bulkcopy method, which leverages the mssql_py_core Rust library to perform high-performance data transfers from Python into SQL Server tables. The method includes robust input validation, connection handling, and error management.

Bulk Copy Feature:

  • Added a new _bulkcopy method to the cursor.py class, allowing bulk data insertion into a SQL Server table using the Rust-based mssql_py_core library. This method supports configurable batch size, timeout, and column mappings, and provides detailed error handling and resource cleanup.

Input Validation and Error Handling:

  • The _bulkcopy method validates its parameters (such as table_name, batch_size, and timeout) and checks for the presence of required connection string components, raising appropriate exceptions for invalid input or missing dependencies.

Integration and Resource Management:

  • Ensures that Rust resources (connection and cursor) are properly closed after the operation, even in the case of exceptions, to prevent resource leaks.

@subrata-ms subrata-ms changed the title Subrata ms/bcp integration BCP implementation in mssql-python driver using rust Jan 14, 2026
@subrata-ms subrata-ms changed the title BCP implementation in mssql-python driver using rust FEAT: BCP implementation in mssql-python driver using rust Jan 16, 2026
@github-actions github-actions bot added the pr-size: small Minimal code update label Jan 16, 2026
@subrata-ms subrata-ms marked this pull request as ready for review January 16, 2026 11:59
Copilot AI review requested due to automatic review settings January 16, 2026 11:59
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 adds a new _bulkcopy method to the Cursor class that enables high-performance bulk data insertion into SQL Server tables using a Rust-based implementation from the mssql_py_core library. The implementation includes connection string parsing, input validation, error handling, and resource cleanup.

Changes:

  • Added _bulkcopy method supporting bulk copy operations with configurable batch size and timeout
  • Implemented connection string parsing to extract database connection parameters
  • Added comprehensive error handling and resource cleanup mechanisms

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

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 5 comments.


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

@github-actions github-actions bot added pr-size: medium Moderate update size and removed pr-size: small Minimal code update labels Jan 19, 2026
@github-actions
Copy link

github-actions bot commented Jan 19, 2026

📊 Code Coverage Report

🔥 Diff Coverage

100%


🎯 Overall Coverage

76%


📈 Total Lines Covered: 5442 out of 7118
📁 Project: mssql-python


Diff Coverage

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

  • mssql_python/cursor.py (100%)

Summary

  • Total: 1 line
  • Missing: 0 lines
  • Coverage: 100%

📋 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.helpers.py: 67.5%
mssql_python.pybind.ddbc_bindings.cpp: 69.4%
mssql_python.pybind.ddbc_bindings.h: 71.7%
mssql_python.pybind.connection.connection.cpp: 73.6%
mssql_python.ddbc_bindings.py: 79.6%
mssql_python.pybind.connection.connection_pool.cpp: 79.6%
mssql_python.connection.py: 84.1%

🔗 Quick Links

⚙️ Build Summary 📋 Coverage Details

View Azure DevOps Build

Browse Full Coverage Report

Copy link
Contributor

@saurabh500 saurabh500 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some API docs comments and some comments about removal of references to programming languages i.e. Python and Rust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-size: medium Moderate update size

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants