Skip to content

Commit 0242a91

Browse files
authored
FEAT: Make _bulkcopy a public API (#449)
…or missing mssql_py_core ### Work Item / Issue Reference <!-- IMPORTANT: Please follow the PR template guidelines below. For mssql-python maintainers: Insert your ADO Work Item ID below For external contributors: Insert Github Issue number below Only one reference is required - either GitHub issue OR ADO Work Item. --> <!-- External contributors: GitHub Issue --> > GitHub Issue: #448 ------------------------------------------------------------------- ### Summary <!-- Insert your summary of changes below. Minimum 10 characters required. --> This change renames `_bulkcopy` to `bulkcopy` to make the feature available in the public API surface area. <!-- ### PR Title Guide > For feature requests FEAT: Expose `bulkcopy` API Change error message to reflect that the absence of mssql_py_core is an internal error
1 parent 69d4757 commit 0242a91

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

mssql_python/cursor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2499,7 +2499,7 @@ def nextset(self) -> Union[bool, None]:
24992499
return True
25002500

25012501
# ── Mapping from ODBC connection-string keywords (lowercase, as _parse returns)
2502-
def _bulkcopy(
2502+
def bulkcopy(
25032503
self,
25042504
table_name: str,
25052505
data: Iterable[Union[Tuple, List]],
@@ -2579,8 +2579,8 @@ def _bulkcopy(
25792579
import mssql_py_core
25802580
except ImportError as exc:
25812581
raise ImportError(
2582-
"Bulk copy requires the mssql_py_core library which is not installed. "
2583-
"To install, run: pip install mssql_py_core "
2582+
"Bulk copy requires the mssql_py_core library which is not available. "
2583+
"This is an unexpected error. "
25842584
) from exc
25852585

25862586
# Validate inputs

tests/test_019_bulkcopy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def test_bulkcopy_basic(cursor):
6565

6666
# Perform bulkcopy with auto-mapping (no column_mappings specified)
6767
# Using explicit timeout parameter instead of kwargs
68-
result = cursor._bulkcopy(table_name, data, timeout=60)
68+
result = cursor.bulkcopy(table_name, data, timeout=60)
6969

7070
# Verify result
7171
assert result is not None

0 commit comments

Comments
 (0)