Skip to content

FEAT: Add JSON Arrow fetching and release-gated bulk input - #928

Open
Jahnvi Thakkar (jahnvi480) wants to merge 6 commits into
mainfrom
jahnvi/json-bulk-python-integration
Open

Jahnvi Thakkar (jahnvi480) wants to merge 6 commits into
mainfrom
jahnvi/json-bulk-python-integration

Conversation

@jahnvi480

@jahnvi480 Jahnvi Thakkar (jahnvi480) commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Work Item / Issue Reference

Not applicable; GitHub issue referenced below.

GitHub Issue: #261 (related work; does not close the issue)


Summary

Add native JSON Arrow fetching as large_string() text and prepare lazy, mapped Json bulk-copy adaptation for the merged Rust contract.

  • Stream native JSON through the UTF-16 LOB path, including small reported column sizes; preserve SQL NULL, schema-only and empty results, and independence from json_output.
  • Adapt only mapped Json snapshots to the internal carrier without parsing, reserializing, look-ahead, or replay. Preserve legacy cells, vector rejection, and exact old-core diagnostic translation.
  • Require PyArrow >=21.0.0 in the Arrow extra and document canonical JSON input, schema checks, and transaction boundaries.
  • Add wrapper, native Arrow, producer-failure, persisted-batch, and JSON integration tests.
  • Correct the mixed snapshot/legacy-cell test: permit and count serialization of the legitimate legacy dictionary while still rejecting parsing or reserialization of the typed JSON snapshot.

Remaining release gates: The committed Rust pin remains mssql-python-rs==0.5.0; the typed JSON bulk bridge remains disabled until a published runtime containing both the carrier and fail-fast source handling is qualified and pinned. The combined source builds have now passed real native-JSON integration on Windows and Linux against SQL Server 2025. This used a development-only JSON-capable ODBC preview, not qualification of the shipped provider or a production redistributable. macOS source-build qualification was not run. No full-suite or complete OS/Python/architecture matrix qualification is claimed.

Validation

Performance investigation: CI slowdown not yet explained

CI build 196138 reported a +35.3% median paired latency increase for ASCII-medium text fetchall on SQL Server 2022. Two local base/PR comparisons did not reproduce a consistent regression, but do not establish zero regression or explain the original CI result. No speculative performance fix was committed; production code, benchmark workloads and reporting thresholds remain unchanged.

Compared base df875895484e9219753bb5bdce9f62cfb462692b with head f1964e3d70662a18ab5d8f170523fc460f0c590f. GitHub confirmed the CI candidate merge f8ebe38c24abf345589e14853f768706fc544002 has exactly the same tree as that head. Each revision used separate Release (-O3 -DNDEBUG) builds with native profiling both enabled and compiled out. Fresh processes verified their source/native import paths and profiling mode. Both sides used the identical shipped ODBC 18.6.2.2 library, not the JSON development preview.

Used the existing text_conversion_fetchall workloads unchanged: eight text columns, 5,000 rows for short/medium payloads and 200 rows for full-width payloads, with stored-byte and every-value correctness checks. Timed only public fetchall, including row wrapping; setup, query execution, validation and cleanup were excluded. Discarded one warmup pair per mode and alternated base/head order. There were no competing builds during measurement.

Workload Debian 12 / Python 3.13.15 / GCC 12.2 release, 5 pairs Ubuntu 24.04 / Python 3.12.3 / GCC 13.3 release, 10 pairs Ubuntu profiled, 10 pairs
ASCII medium (CI flagged) -0.13% +6.63% -10.54%
UTF8 medium +0.85% -0.50% +16.32%
CP1252 full -5.75% +2.59% -9.85%
CP1252 medium -0.46% +5.64% -3.86%
NVARCHAR medium -16.72% -4.22% -2.00%
ASCII short -8.15% +5.16% -2.48%

Values are median paired percentage changes in latency; positive means slower. These are not ratios of marginal medians. No local case meets the existing consistent-regression reporting criterion. Dispersion is substantial: Ubuntu release ASCII-medium base median was 36.31 ms, range 32.68–38.24 ms; head median 36.08 ms, range 31.77–52.78 ms. One of ten pairs exceeded +20%. Chronological paired changes were +8.09%, -3.02%, -5.73%, -13.61%, -3.40%, +38.02%, +8.09%, +15.17%, +7.65%, +5.60%.

In the original CI samples, much of the increase was inside the unchanged SQLFetchScroll_call timer. Both revisions made exactly 78 fetch calls and 77 row-construction/metadata batches, also confirmed in every local profiled ASCII-medium sample. This excludes additional fetch calls for that workload; it does not prove a root cause or rule out other effects.

Limits: Ubuntu matches CI's client Python/compiler versions, but runs under local Docker/WSL2 rather than the CI host. Local SQL2022 was 16.0.4225.2, versus 16.0.4325.4 in the affected CI run. These experiments do not qualify Windows/macOS/ARM64 performance, Arrow throughput, or bulk-copy throughput. The original CI regression remains unresolved pending reproducible source-level evidence or a comparable affected-environment run; the PR remains draft.

Commands below ran from the Python worktree, with $P pointing to the retained local performance-artifact directory. Harness scripts are local artifacts, not repository files:

Command Result
.\.venv\Scripts\python.exe "$P\run_comparison.py" --image mssql-python-perf-928:base-head --label base-head-run1 Passed: all six workloads and correctness assertions, five measured pairs per profiling/release mode
.\.venv\Scripts\python.exe "$P\summarize.py" "$P\base-head-run1" Passed: raw paired observations, medians and ranges retained
.\.venv\Scripts\python.exe "$P\run_comparison.py" --image mssql-python-perf-928:ubuntu-base-head --label ubuntu-base-head-run1 --rounds 11 Passed: all six workloads and correctness assertions, ten measured pairs per profiling/release mode
.\.venv\Scripts\python.exe "$P\summarize.py" "$P\ubuntu-base-head-run1" Passed: raw paired observations, medians and ranges retained

Raw outputs, provenance, build logs, scripts and performance-report.md are retained locally under perf-928; nothing was filtered to remove outliers. All task-owned SQL/client/build containers were removed with ownership and absence checks. Local images/evidence were retained, not published. No code change or new commit resulted from this investigation.

Real native-JSON source-build qualification

Tested Python production code at af29814308203e14f1effc46f3eb2b0ae8e773a2 with source-built Rust runtime d24a843c11861664395816efa58a129b3f783707. The test-only correction used in the passing runs is now committed as f1964e3d70662a18ab5d8f170523fc460f0c590f; its file hash was verified identical to the tested overlay before and after commit. Publication did not change production code, and no new live run is claimed after the byte-identical commit.

Both platforms rebuilt the C++ extension and used PyArrow 21.0.0, SQL Server 2025 17.0.5005.3, and an isolated development-only JSON-capable ODBC preview. The bootstrap verified actual query metadata SQL_JSON=-157, provider/native-library hashes, and the installed Rust wheel's SHA256. These runs used actual JSON server storage, not metadata interposition. MSSQL_TEST_NATIVE_JSON=1 was enabled after the capability probe. The private bulk qualification gate was enabled only inside the source-runtime test process; the production gate remains False.

Client / environment Source-runtime JSON integration Actual published Rust 0.5.0 compatibility
Windows x64, Python 3.13.17 123 passed, 0 skipped, 340 deselected 6 passed, 0 skipped, 287 deselected
Debian 12 x86_64 on Docker/WSL2, Python 3.13.15 123 passed, 0 skipped, 340 deselected 6 passed, 0 skipped, 287 deselected; isolated OpenSSL 1.1 libraries required
macOS Not run Not run

The same 123 case identities ran on Windows and Linux. Coverage includes native Json row bulk input, plain/canonical Arrow input, actual JSON Arrow output as large_string, SQL NULL, Unicode/large payloads, malformed/scalar document rejection, mapped/unmapped cells, producer failures, later-reader schema errors, and persistence of already committed batches. The six old-runtime cases cover typed rejection without tail consumption, diagnostic translation, unrelated-error preservation, and legacy dict/list/string/NULL JSON round trips. These counts include repository tests plus local qualification-only payload/baseline probes; they are not a full repository-suite count and do not qualify TVP or async JSON APIs.

Commands and results: the following were run from the retained local qualification-artifact directory. The lifecycle harness, manifests, bootstrap/probes, logs, JUnit and provenance are local test artifacts, not files committed by this PR. The harness injects credentials through the environment and supplies an isolated provider/runtime to the tests.

Command Result
python .\qualify_json_source_builds.py .\json-windows-qualified.json --output .\json-windows-qualified Passed: source runtime 123/123; published 0.5.0 baseline 6/6; owned SQL container cleanup verified
python .\qualify_json_source_builds.py .\json-linux-qualified.json --output .\json-linux-qualified Passed: source runtime 123/123; owned SQL/client container cleanup verified
python .\qualify_json_source_builds.py .\json-linux-baseline-qualified.json --output .\json-linux-baseline-qualified Passed: published 0.5.0 baseline 6/6 with isolated compatibility libraries; owned SQL/client container cleanup verified

The source-runtime bootstrap calls pytest on tests/test_json.py, tests/test_024_bulkcopy_arrow.py and the local qualify_json_payloads.py, selecting bulk_json or json_bulk or bulk_arrow_json or bulk_source_failure or json_arrow_returns or large_unicode_json_bulk or typed_json_invalid_document, with -q --no-cov --tb=short -rs and JUnit output.

Exact-source Rust importer/carrier/source-failure regressions also passed on Windows: 89 passed, 446 excluded. With $F pointing to the retained qualification-artifact root and the qualified Python environment selected, the command was:

cargo nextest run --manifest-path "$F\rust-source\microsoft-mssql-rs-d24a843\mssql-py-core\Cargo.toml" --locked --lib -E 'test(/^bulkcopy::tests::/) | test(/^arrow_bulkcopy::tests::/) | test(/^cursor::tests::/) | test(/^connection::tests::/)'

Source-built Rust wheel SHA256 values:

  • Windows: 2777e457fb7d33186ffae48af150ef23d0557255c1e81f9b59a6a1d2a2153e5f
  • Linux: dd9cef10ddaf55651eff695e0d07cc0bf4208ae7767885ce7d45cf4f4ec8c40d

The local runtime identifies as 0.6.0; this is not a published release. No preview binaries, wheels, credentials or test bootstrap were committed or published.

Failures encountered and resolved: the initial Windows exact-head run was 114 passed / 1 failed / 8 skipped. The failure was a test mock globally blocking json.dumps, including legitimate legacy-dictionary conversion; the narrow correction now in this PR preserves the no-reserialization assertion for typed snapshots. Eight cases initially skipped because the explicit native-JSON test flag was absent, then ran after the real capability probe. The initial Linux 0.5.0 baseline had 3 passes / 3 import failures because that published wheel requires libssl.so.1.1; genuine OpenSSL 1.1 libraries were added only to the isolated baseline container, with no host install or ABI substitution. The corrected baseline passed 6/6. Original failures and final results were retained separately.

All temporary SQL/client containers were removed and their absence verified. No system ODBC installation or production dependency/gate was changed.

Earlier SQL Server 2019 evidence and formatting/typing checks

The earlier Windows x64/Python 3.13.17/PyArrow 21.0.0 checks below are retained for transparency. Native JSON storage cases skipped on SQL Server 2019; the 14-case native Arrow selection used metadata interposition over real SQLGetData. Those earlier results alone were not native-storage qualification; the SQL Server 2025 results above supply that evidence.

Command (from Python worktree root) Result
.\.venv\Scripts\python.exe -m pytest tests\test_json.py tests\test_020_bulkcopy_auth_cleanup.py tests\test_024_bulkcopy_arrow.py -k 'not TestBulkcopyArrowLive' -q --no-cov 129 passed, 304 skipped, 31 deselected
.\.venv\Scripts\python.exe -m pytest -p qualified_json_runtime tests\test_json.py tests\test_024_bulkcopy_arrow.py -k 'bulk_source_failure or bulk_arrow_json or bulk_json_native' -q --no-cov 31 passed, 59 skipped, 358 deselected
.\.venv\Scripts\python.exe -m pytest tests\test_004_cursor_arrow.py -k 'native_json_arrow_streams or test_arrow_lob_wide or test_arrow_nolob_wide or test_arrow_single_column or test_arrow_empty_fetch or test_arrow_long_string' -q --no-cov 14 passed, 124 deselected
.\.venv\Scripts\python.exe -m pytest tests\test_typing.py -m typing -q --no-cov 9 passed with pinned mypy 2.3.1
.\.venv\Scripts\python.exe -m pre_commit validate-config Passed
.\.venv\Scripts\python.exe -m pre_commit run black-check --all-files --hook-stage pre-push Passed; rerun before committing/pushing the correction
git diff --check Passed; rerun before committing/pushing the correction

The earlier qualified_json_runtime plugin is also a local, non-repository test-process gate with exact wheel hash verification, not a production bypass. Commit/push hooks passed for f1964e3d; the PR remains draft.

Add native JSON Arrow text fetching and lazy mapped Json snapshots. Keep bulk enablement disabled pending a qualified published Rust runtime, and cover native fetch, source failure, and transaction contracts.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 05:53
@github-actions github-actions Bot added the pr-size: large Substantial code update label Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

PR Performance Report

✅ No regression detected

No 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 diagnostics

Phase 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 timings

Unix / SQL Server 2022

Database task Before After Paired change Result
Connection opening 10.076 ms 10.097 ms +0.2% no signal
SELECT queries 1.254 ms 1.305 ms +3.9% no signal
Row insertion 31.697 ms 32.000 ms +0.6% no signal
Executemany inserts 159.029 ms 171.772 ms +10.4% no signal
Fetch-all queries 120.794 ms 121.325 ms -0.4% no signal
Row-by-row fetching 6.185 ms 6.170 ms -1.0% no signal
Batched row fetching 120.246 ms 118.275 ms -2.5% no signal
Transaction commit and rollback 107.507 ms 108.484 ms -0.5% no signal
Arrow row fetching 99.155 ms 99.810 ms -0.4% no signal
100,000-row insertion 359.052 ms 359.055 ms -0.4% no signal
Row fetching in batches of 100 126.855 ms 126.846 ms +3.0% no signal
Row fetching in batches of 10,000 128.365 ms 122.751 ms -2.5% no signal
Repeated positional queries 33.731 ms 33.695 ms -0.1% no signal
Repeated named-parameter queries 33.776 ms 33.725 ms -0.4% no signal
Legacy 100,000-row insertion 281.585 ms 271.924 ms -1.7% no signal
Insertion with explicit input sizes 528.024 ms 541.664 ms -0.2% no signal
Joined aggregation queries 179.475 ms 179.999 ms -0.2% no signal
Large joined-result fetching 192.699 ms 191.755 ms -0.4% no signal
1.2-million-row fetching 3577.058 ms 3574.537 ms -0.4% no signal
Common table expression queries 5.359 ms 5.555 ms +4.1% no signal
256 KiB VARCHAR(MAX) / fetchall() 1.273 ms 1.216 ms -7.0% no signal
10,000 scalar values / fetchval() (debug disabled) 19.420 ms 19.813 ms +0.4% no signal
10,000 output-converted rows / fetchall() 19.362 ms 19.586 ms -0.1% no signal
10,000 output-converted rows / fetchmany(1000) 23.384 ms 23.621 ms +0.2% no signal
10,000 INT/NVARCHAR rows / fetchmany(1) 28.332 ms 28.161 ms -0.6% no signal
5,000 x 8 VARCHAR(8000) / ASCII to UTF-16 40.141 ms 38.063 ms -5.2% no signal
5,000 x 8 VARCHAR(8000) / CP1252 to UTF-16 52.274 ms 53.512 ms -4.4% no signal
5,000 x 8 VARCHAR(8000) / UTF-8 to UTF-16 (astral) 111.135 ms 96.364 ms -16.2% no signal
5,000 x 8 NVARCHAR(4000) / UTF-16 (astral) 87.823 ms 89.174 ms +1.1% no signal
5,000 x 8 VARCHAR(8000) / short ASCII 10.442 ms 10.096 ms -3.3% no signal
200 x 8 VARCHAR(8000) / full-width ASCII 44.459 ms 43.630 ms -2.3% no signal
5,000 x 8 VARCHAR(8000) / short CP1252 13.088 ms 12.935 ms -1.2% no signal
200 x 8 VARCHAR(8000) / full-width CP1252 43.050 ms 43.508 ms -1.3% no signal
5,000 x 8 VARCHAR(8000) / short UTF-8 (astral) 16.510 ms 15.991 ms -2.8% no signal
200 x 8 VARCHAR(8000) / full-width UTF-8 (astral) 47.188 ms 46.789 ms -0.8% no signal
5,000 x 8 NVARCHAR(4000) / short UTF-16 (astral) 14.292 ms 14.088 ms -0.7% no signal
200 x 8 NVARCHAR(4000) / full-width UTF-16 (astral) 58.603 ms 61.320 ms +7.8% no signal
200,000 x 8 VARCHAR(32) / fetchall control 550.014 ms 513.568 ms -6.6% no signal
200,000 x 8 INT / fetchall control 290.549 ms 274.208 ms -5.6% no signal
10,000 rows x 32 columns / dict(row._mapping) (warm) 30.835 ms 30.779 ms -0.3% no signal

Unix / SQL Server 2025

Database task Before After Paired change Result
Connection opening 81.032 ms 80.952 ms -0.2% no signal
SELECT queries 1.378 ms 1.310 ms -0.9% no signal
Row insertion 32.198 ms 33.059 ms +2.8% no signal
Executemany inserts 155.151 ms 155.443 ms +1.5% no signal
Fetch-all queries 122.592 ms 121.745 ms -0.4% no signal
Row-by-row fetching 6.110 ms 6.094 ms -0.1% no signal
Batched row fetching 118.845 ms 119.955 ms +1.4% no signal
Transaction commit and rollback 111.673 ms 109.732 ms -0.8% no signal
Arrow row fetching 100.402 ms 99.115 ms -0.3% no signal
100,000-row insertion 379.772 ms 378.352 ms -0.6% no signal
Row fetching in batches of 100 127.668 ms 125.406 ms +0.2% no signal
Row fetching in batches of 10,000 124.987 ms 123.917 ms -0.9% no signal
Repeated positional queries 33.820 ms 33.639 ms -0.5% no signal
Repeated named-parameter queries 34.516 ms 33.773 ms -1.9% no signal
Legacy 100,000-row insertion 271.028 ms 269.648 ms -0.6% no signal
Insertion with explicit input sizes 542.267 ms 544.981 ms +0.5% no signal
Joined aggregation queries 163.759 ms 164.940 ms +0.7% no signal
Large joined-result fetching 191.079 ms 189.831 ms -1.4% no signal
1.2-million-row fetching 3668.244 ms 3577.028 ms -1.3% no signal
Common table expression queries 5.362 ms 5.242 ms -1.6% no signal
256 KiB VARCHAR(MAX) / fetchall() 1.708 ms 1.332 ms -18.7% no signal
10,000 scalar values / fetchval() (debug disabled) 19.764 ms 19.407 ms -2.1% no signal
10,000 output-converted rows / fetchall() 20.024 ms 19.265 ms -1.9% no signal
10,000 output-converted rows / fetchmany(1000) 23.500 ms 23.135 ms -1.3% no signal
10,000 INT/NVARCHAR rows / fetchmany(1) 27.751 ms 27.544 ms -0.7% no signal
5,000 x 8 VARCHAR(8000) / ASCII to UTF-16 48.948 ms 43.628 ms -10.9% no signal
5,000 x 8 VARCHAR(8000) / CP1252 to UTF-16 60.071 ms 55.884 ms -7.8% no signal
5,000 x 8 VARCHAR(8000) / UTF-8 to UTF-16 (astral) 117.449 ms 103.599 ms -11.6% no signal
5,000 x 8 NVARCHAR(4000) / UTF-16 (astral) 122.014 ms 124.298 ms +4.7% no signal
5,000 x 8 VARCHAR(8000) / short ASCII 10.038 ms 10.220 ms +1.8% no signal
200 x 8 VARCHAR(8000) / full-width ASCII 47.367 ms 49.944 ms +1.3% no signal
5,000 x 8 VARCHAR(8000) / short CP1252 13.347 ms 12.893 ms -3.7% no signal
200 x 8 VARCHAR(8000) / full-width CP1252 62.899 ms 53.725 ms -11.3% no signal
5,000 x 8 VARCHAR(8000) / short UTF-8 (astral) 16.024 ms 15.949 ms -0.3% no signal
200 x 8 VARCHAR(8000) / full-width UTF-8 (astral) 51.025 ms 52.381 ms +2.1% no signal
5,000 x 8 NVARCHAR(4000) / short UTF-16 (astral) 14.209 ms 14.371 ms +0.5% no signal
200 x 8 NVARCHAR(4000) / full-width UTF-16 (astral) 76.157 ms 76.735 ms -1.5% no signal
200,000 x 8 VARCHAR(32) / fetchall control 532.849 ms 511.098 ms -4.1% no signal
200,000 x 8 INT / fetchall control 275.016 ms 282.536 ms +0.8% no signal
10,000 rows x 32 columns / dict(row._mapping) (warm) 30.437 ms 30.434 ms +0.6% no signal
Build and measurement details

ADO build 196381

PR head: b3f8ab9482c7dbfde1ebcad3446495f5b3faac8d
Base: 70e0003c242f132b60e5c79957726eb2c91510b1
Measured merge: 8084360c7d6e1f0e78c82fdbc526e85a6742ec80

  • Unix / SQL Server 2022: Python 3.12.3, x86_64, SQL 16.0.4325.4; 5 paired comparisons and 1 warmup.
  • Unix / SQL Server 2025: Python 3.12.3, x86_64, SQL 17.0.5065.9; 5 paired comparisons and 1 warmup.

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 profiler-* artifacts.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The JSON adaptation helper converts list rows into tuples, bypassing the tuple/Row-only contract for mixed sources containing Json values.

1 open issue
What changed in this PR

Adds native JSON Arrow fetching to the synchronous driver and prepares typed JSON bulk input behind a release gate. This advances related work in #261 without claiming to resolve it; bulk input remains disabled on the current Rust runtime pin.

Changes:

  • Fetch native JSON as Arrow large_string() text through the UTF-16 streaming path.
  • Add lazy, mapped Json adaptation and document runtime requirements and transaction boundaries.
  • Require PyArrow 21+ and expand fetching, bulk-input, and producer-failure coverage.
File Description
tests/​test_json.py Tests JSON Arrow output and gated bulk adaptation.
tests/​test_024_bulkcopy_arrow.py Adds JSON producer, schema, and failure-boundary tests.
tests/​test_004_cursor_arrow.py Tests native JSON streaming with small reported column sizes.
tests/​conftest.py Adds qualified-runtime and JSON-server fixtures.
setup.py Raises the PyArrow extra minimum to 21.0.0.
README.md Documents JSON fetching, bulk release gates, and transaction limits.
mssql_python/​pybind/​ddbc_bindings.cpp Routes JSON Arrow values through wide-character streaming.
mssql_python/​json.py Adds lazy adaptation of mapped Json snapshots.
mssql_python/​cursor.py Enables JSON Arrow fetching and gates typed bulk adaptation.
mssql_python/​_pycore_types.pyi Declares the internal JSON carrier interface.

Review effort: Balanced

Comment thread mssql_python/json.py Resolved
Pass non-tuple rows through unchanged for native rejection. Add mixed tuple/list regressions for typed JSON and ordinary strings, covering row identity, lazy failure, and active-batch rollback.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 07:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Native JSON Arrow support requires human qualification with a real JSON-capable provider/server and across shipped platforms, because reported tests substituted NVARCHAR metadata rather than exercising actual JSON storage.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Allow json.dumps only for the reused legacy dictionary and assert exactly one serialization per row, while still rejecting snapshot reserialization and parsing.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 08:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Native JSON round trips remain unverified because validation used simulated metadata and an unpublished Rust wheel, leaving real-server, published-runtime, and cross-platform qualification for human review.

No open issues 🎉

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings December 2, 2026 01:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Development-only ODBC qualification leaves shipped-provider and macOS coverage unverified, while the unresolved 35.3% CI fetchall slowdown lacks comparable-runtime evidence and requires human assessment.

No open issues 🎉

Review effort: Balanced

@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

📊 Code Coverage Report

🔥 Diff Coverage

91%


🎯 Overall Coverage

87%


📈 Total Lines Covered: 15178 out of 17402
📁 Project: mssql-python


Diff Coverage

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

  • mssql_python/cursor.py (100%)
  • mssql_python/json.py (92.9%): Missing lines 100
  • mssql_python/pybind/ddbc_bindings.cpp (87.5%): Missing lines 7468

Summary

  • Total: 24 lines
  • Missing: 2 lines
  • Coverage: 91%

mssql_python/json.py

Lines 96-104

   96     for row in rows:
   97         if not isinstance(row, tuple):
   98             # Preserve invalid row shapes for the native writer to reject.
   99             yield row
! 100             continue
  101         converted = None
  102         for index, value in enumerate(row):
  103             if (mapped is None or index in mapped) and type(value) is Json:
  104                 if converted is None:

mssql_python/pybind/ddbc_bindings.cpp

Lines 7464-7472

  7464         fixedValueSizes[i] = FixedFetchValueSize(dataType);
  7465         columnNullable[i] = (nullable != SQL_NO_NULLS);
  7466 
  7467         if (dataType == SQL_SS_JSON ||
! 7468             ((dataType == SQL_WVARCHAR || dataType == SQL_WLONGVARCHAR || dataType == SQL_VARCHAR ||
  7469              dataType == SQL_LONGVARCHAR || dataType == SQL_VARBINARY ||
  7470              dataType == SQL_LONGVARBINARY || dataType == SQL_SS_XML || dataType == SQL_SS_UDT) &&
  7471              (columnSize == 0 || columnSize == SQL_NO_TOTAL || columnSize > SQL_MAX_LOB_SIZE))) {
  7472             hasLobColumns = true;


📋 Files Needing Attention

📉 Files with overall lowest coverage (click to expand)
mssql_python.pybind.performance_counter.hpp: 0.7%
mssql_python.pybind.logger_bridge.cpp: 57.9%
mssql_python.pybind.vector_support.hpp: 59.5%
mssql_python.pybind.ddbc_bindings.h: 75.4%
mssql_python._native_fetch.py: 80.1%
mssql_python.pybind.row_mapping_cache.hpp: 81.5%
mssql_python.pybind.connection.connection_pool.cpp: 82.5%
mssql_python.pybind.ddbc_bindings.cpp: 83.9%
mssql_python.pybind.connection.connection.cpp: 84.9%
mssql_python.logging.py: 86.8%

🔗 Quick Links

⚙️ Build Summary 📋 Coverage Details

View Azure DevOps Build

Browse Full Coverage Report

@jahnvi480
Jahnvi Thakkar (jahnvi480) marked this pull request as ready for review December 2, 2026 04:55
Copilot AI balanced review requested due to automatic review settings December 2, 2026 04:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Native JSON lacks shipped-provider and macOS/ARM64 qualification, while an unexplained CI fetchall slowdown requires human compatibility and performance review.

No open issues 🎉

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings December 2, 2026 09:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Incomplete provider/platform qualification and an unexplained 35.3% CI fetchall slowdown require human assessment of the cross-language native JSON Arrow changes.

No open issues 🎉

Review effort: Balanced

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

Labels

pr-size: large Substantial code update

2 participants