CHORE: e2e bulk copy into a CLR UDT column (GH-667)#683
Open
gargsaumya wants to merge 1 commit into
Open
Conversation
Adds an end-to-end bulkcopy test using the built-in geometry CLR UDT (same 0xF0 wire path as custom UDTs, which need a deployed assembly). Seeds a geometry column, reads the serialized UDT bytes, bulk copies them into a second geometry column, and asserts a byte-exact round-trip including a NULL. Requires the GH-667 fix in mssql_py_core (microsoft/mssql-rs#111): the varbinary(max) wire mapping plus bytes->UDT value coercion. Lands with the mssql-py-core version bump.
gargsaumya
force-pushed
the
saumya/gh667-bulkcopy-udt-e2e
branch
from
July 16, 2026 12:19
d6b27fb to
f389d0c
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an end-to-end regression test to validate that cursor.bulkcopy() can insert CLR UDT values (via the built-in geometry type) by round-tripping the UDT’s serialized bytes, covering both non-NULL and NULL rows. This extends the bulkcopy integration suite to exercise the TDS 0xF0 (UDT) wire path via mssql_py_core.
Changes:
- Add
test_bulkcopy_udt_geometryto seedgeometryvalues, fetch their serialized form, bulk copy into a secondgeometrycolumn, and assert byte-exact equality. - Ensure the test explicitly covers a NULL row alongside non-NULL UDT values.
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.
Adds an end-to-end
bulkcopytest for CLR UDT columns (GH-667).Summary
What
test_bulkcopy_udt_geometryseeds ageometrycolumn, reads the serialized UDT bytes back, bulk copies them into a secondgeometrycolumn, and asserts a byte-exact round-trip (including a NULL row).The built-in
geometryCLR UDT travels the identical TDS0xF0wire path as custom UDTs (which require a deployed assembly, impractical in CI), so it faithfully exercises the fixed path.Why
Before the fix,
cursor.bulkcopy()into any UDT column failed - first with a malformedvarbinary(-1)/Unsupported TDS type for bulk copy: 0xF0, and (once the wire mapping was fixed) with atarget SQL type is Udtvalue-coercion error.Dependency
This test requires the GH-667 fix in
mssql_py_core(microsoft/mssql-rs#111), which contains two parts:mssql-tds: map UDT tovarbinary(max)for the bulk-copy wire type / COLMETADATA / statement text.mssql-py-core: acceptbytes-> UDT in bulk-copy value coercion.Validated locally end-to-end against SQL Server with a py-core built from that branch. This should land together with the
mssql-py-coreversion bump that ships the fix (the maintainers will handle the bump).Related: microsoft/mssql-rs#111 · Fixes #667