Repository navigation
FEAT: Add native JSON columns to synchronous TVPs - #929
Jahnvi Thakkar (jahnvi480) wants to merge 1 commit into
Conversation
Support explicit Json snapshots and NULLs in native JSON TVP columns, preserving lazy streaming and provider diagnostics. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
PR Performance Report✅ No regression detectedNo consistent slowdowns detected across all 2 environments. 0 IMPROVEMENTS 0 SLOWDOWNS 2/2 ENVIRONMENTS Coverage: 2 of 2 environments completed. Advisory result; does not block merging. Performance diagnosticsPhase times are inclusive diagnostics and must not be added together. They identify where measured time changed, not why it changed. No affected phases or call-count changes were recorded. All database tasks and timingsUnix / SQL Server 2022
Unix / SQL Server 2025
Build and measurement detailsPR head:
A consistent change requires more than 20% median paired movement, at least 1 ms between the median runtimes, and at least 80% of pairs exceeding the relative threshold in the same direction. A slowdown without enough pair agreement is reported as inconsistent. The displayed change is the median of paired before-and-after ratios. It is not recalculated from the two displayed median runtimes. Both revisions use profiling-enabled builds on the same agent and database, with alternating order and discarded warmups. Results are diagnostic and do not represent production-wheel latency. Raw samples and logs are attached to the ADO run as |
There was a problem hiding this comment.
🔵 Needs a closer look
The native JSON TVP path requires maintainer confirmation because its reported binding and recovery results cannot be independently validated without the unbundled preview ODBC provider and a live SQL Server.
No open issues 🎉
What changed in this PR
Adds native JSON columns to the existing synchronous TableValuedParameter API, using explicit Json snapshots and native ODBC binding without a text fallback. Successful execution requires a JSON-TVP-capable provider; the bundled released provider is not yet supported.
Changes:
- Accepts
SQL_JSONcolumns withJsonorNonecells and validates size/scale restrictions. - Unwraps JSON snapshots in copied binding rows and preserves unsupported-provider diagnostics.
- Adds contract, streaming, recovery, result-handling, and typing coverage, plus usage documentation.
| File | Description |
|---|---|
tests/test_typing.py |
Adds consumer typing coverage for JSON TVP cells. |
tests/test_028_table_valued_parameters.py |
Tests JSON contracts, streaming, results, recovery, and unsupported-provider rejection. |
README.md |
Documents JSON TVP usage, restrictions, and provider requirements. |
mssql_python/table_valued_parameter.py |
Accepts JSON columns and validates their metadata and cell types. |
mssql_python/pybind/tvp.hpp |
Unwraps JSON snapshots for binding and handles JSON-specific binding errors. |
Review effort: Balanced
Work Item / Issue Reference
Summary
Add native JSON columns to the existing synchronous TableValuedParameter API.
Validation:
build.bat x64frommssql_python\pybind— passed.python -m pytest tests/test_028_table_valued_parameters.py tests/test_json.py tests/test_042_execute_param_rebind.py -q --no-covwith the qualified preview andMSSQL_TEST_NATIVE_JSON=1— 342 passed, 9 expected shipped/legacy skips, 1 stress deselection.python -m pytest tests/test_typing.py -m typing -q --no-cov— 9 passed.python -m pre_commit run black-check --all-files --hook-stage pre-push— passed.git diff --check— passed.Provider/server qualification: