FIX: Invalid check for database in connection string in _bulkcopy#445
Open
subrata-ms wants to merge 5 commits intomainfrom
Open
FIX: Invalid check for database in connection string in _bulkcopy#445subrata-ms wants to merge 5 commits intomainfrom
subrata-ms wants to merge 5 commits intomainfrom
Conversation
📊 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.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
|
Contributor
There was a problem hiding this comment.
Pull request overview
Updates bulk copy connection-string validation so DATABASE is no longer required, matching SQL Server’s default-database behavior, and adds tests to validate bulk copy behavior when DATABASE is omitted.
Changes:
- Remove the
_bulkcopy()hard requirement thatDATABASEbe present in the connection string. - Add an integration test validating bulk copy works when
DATABASEis omitted. - Add tests around
SERVERparameter handling (including synonyms and missing-server failure).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
mssql_python/cursor.py |
Removes the DATABASE-required guard; keeps a guard ensuring some server key is present before starting py-core bulk copy. |
tests/test_019_bulkcopy.py |
Adds new bulk copy integration tests for missing DATABASE, server-key synonyms, and missing server failure behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
saurabh500
approved these changes
Feb 24, 2026
saurabh500
approved these changes
Feb 24, 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.
Summary
This pull request updates the bulk copy functionality to make the
DATABASEparameter in the connection string optional, aligning behavior with SQL Server's default handling. It also adds a new test to ensure this works as expected. The most important changes are:Bulk copy connection string handling:
_bulkcopymethod incursor.pyto remove the requirement for theDATABASEparameter in the connection string; now, bulk copy will proceed as long as a server is specified, and the server will use the default database if none is provided.Testing improvements:
test_bulkcopy_without_database_parameter, intest_019_bulkcopy.pyto verify that bulk copy works correctly when theDATABASEparameter is omitted, ensuring the client connects to the default database and data is inserted as expected.