Skip to content

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

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

Jahnvi Thakkar (jahnvi480) wants to merge 5 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.323 ms 10.419 ms -2.9% no signal
SELECT queries 1.362 ms 1.257 ms -6.3% no signal
Row insertion 31.378 ms 32.458 ms +0.8% no signal
Executemany inserts 156.884 ms 157.628 ms -0.1% no signal
Fetch-all queries 121.436 ms 141.772 ms +17.1% no signal
Row-by-row fetching 6.158 ms 6.228 ms -2.3% no signal
Batched row fetching 119.644 ms 118.722 ms -0.8% no signal
Transaction commit and rollback 107.230 ms 106.352 ms +1.2% no signal
Arrow row fetching 100.286 ms 101.351 ms +0.2% no signal
100,000-row insertion 363.609 ms 372.487 ms -0.7% no signal
Row fetching in batches of 100 126.013 ms 128.187 ms +1.7% no signal
Row fetching in batches of 10,000 125.167 ms 135.893 ms +8.6% no signal
Repeated positional queries 32.995 ms 33.313 ms +0.5% no signal
Repeated named-parameter queries 33.549 ms 33.836 ms -1.2% no signal
Legacy 100,000-row insertion 285.826 ms 290.068 ms +1.5% no signal
Insertion with explicit input sizes 552.168 ms 542.036 ms +3.0% no signal
Joined aggregation queries 177.898 ms 180.067 ms +1.8% no signal
Large joined-result fetching 199.796 ms 192.440 ms +0.2% no signal
1.2-million-row fetching 3557.691 ms 3568.637 ms +0.2% no signal
Common table expression queries 5.332 ms 5.358 ms +0.9% no signal
256 KiB VARCHAR(MAX) / fetchall() 1.303 ms 1.325 ms +0.5% no signal
10,000 scalar values / fetchval() (debug disabled) 19.509 ms 19.515 ms +0.2% no signal
10,000 output-converted rows / fetchall() 19.608 ms 19.564 ms -1.0% no signal
10,000 output-converted rows / fetchmany(1000) 23.518 ms 23.611 ms -2.3% no signal
10,000 INT/NVARCHAR rows / fetchmany(1) 28.306 ms 27.893 ms -0.7% no signal
5,000 x 8 VARCHAR(8000) / ASCII to UTF-16 45.002 ms 40.855 ms +3.7% no signal
5,000 x 8 VARCHAR(8000) / CP1252 to UTF-16 55.204 ms 57.528 ms -3.7% no signal
5,000 x 8 VARCHAR(8000) / UTF-8 to UTF-16 (astral) 111.397 ms 103.797 ms +1.9% no signal
5,000 x 8 NVARCHAR(4000) / UTF-16 (astral) 89.679 ms 91.998 ms +0.3% no signal
5,000 x 8 VARCHAR(8000) / short ASCII 10.167 ms 10.154 ms -0.6% no signal
200 x 8 VARCHAR(8000) / full-width ASCII 42.853 ms 44.331 ms +2.5% no signal
5,000 x 8 VARCHAR(8000) / short CP1252 13.061 ms 12.935 ms -1.8% no signal
200 x 8 VARCHAR(8000) / full-width CP1252 50.427 ms 45.217 ms -4.0% no signal
5,000 x 8 VARCHAR(8000) / short UTF-8 (astral) 16.401 ms 15.932 ms -4.1% no signal
200 x 8 VARCHAR(8000) / full-width UTF-8 (astral) 47.151 ms 47.039 ms -0.1% no signal
5,000 x 8 NVARCHAR(4000) / short UTF-16 (astral) 14.513 ms 14.444 ms +0.3% no signal
200 x 8 NVARCHAR(4000) / full-width UTF-16 (astral) 60.719 ms 60.197 ms +0.3% no signal
200,000 x 8 VARCHAR(32) / fetchall control 530.593 ms 527.982 ms -1.1% no signal
200,000 x 8 INT / fetchall control 289.569 ms 278.931 ms -3.7% no signal
10,000 rows x 32 columns / dict(row._mapping) (warm) 30.917 ms 31.313 ms -0.1% no signal

Unix / SQL Server 2025

Database task Before After Paired change Result
Connection opening 81.210 ms 80.891 ms +0.0% no signal
SELECT queries 1.296 ms 1.348 ms +7.5% no signal
Row insertion 31.864 ms 31.628 ms +0.2% no signal
Executemany inserts 152.579 ms 152.239 ms -0.5% no signal
Fetch-all queries 122.512 ms 125.156 ms +0.8% no signal
Row-by-row fetching 6.166 ms 6.179 ms -0.1% no signal
Batched row fetching 119.265 ms 123.338 ms +4.2% no signal
Transaction commit and rollback 109.015 ms 108.524 ms -0.7% no signal
Arrow row fetching 100.276 ms 100.443 ms +1.9% no signal
100,000-row insertion 379.926 ms 358.818 ms -2.5% no signal
Row fetching in batches of 100 127.622 ms 130.074 ms +2.2% no signal
Row fetching in batches of 10,000 125.056 ms 127.145 ms +2.5% no signal
Repeated positional queries 33.226 ms 34.516 ms +3.5% no signal
Repeated named-parameter queries 33.844 ms 33.538 ms -0.2% no signal
Legacy 100,000-row insertion 272.022 ms 271.002 ms -0.4% no signal
Insertion with explicit input sizes 537.730 ms 517.035 ms -1.9% no signal
Joined aggregation queries 166.561 ms 173.577 ms +1.4% no signal
Large joined-result fetching 184.980 ms 183.168 ms -0.4% no signal
1.2-million-row fetching 3636.206 ms 3553.589 ms -1.6% no signal
Common table expression queries 5.196 ms 5.266 ms +1.3% no signal
256 KiB VARCHAR(MAX) / fetchall() 1.695 ms 1.659 ms -6.6% no signal
10,000 scalar values / fetchval() (debug disabled) 19.758 ms 19.782 ms -0.4% no signal
10,000 output-converted rows / fetchall() 20.346 ms 20.068 ms -2.7% no signal
10,000 output-converted rows / fetchmany(1000) 23.378 ms 23.314 ms +0.1% no signal
10,000 INT/NVARCHAR rows / fetchmany(1) 28.271 ms 28.053 ms -0.1% no signal
5,000 x 8 VARCHAR(8000) / ASCII to UTF-16 50.081 ms 50.250 ms +26.7% no signal
5,000 x 8 VARCHAR(8000) / CP1252 to UTF-16 60.976 ms 60.954 ms +16.9% no signal
5,000 x 8 VARCHAR(8000) / UTF-8 to UTF-16 (astral) 120.460 ms 119.557 ms -0.7% no signal
5,000 x 8 NVARCHAR(4000) / UTF-16 (astral) 117.671 ms 121.013 ms +0.9% no signal
5,000 x 8 VARCHAR(8000) / short ASCII 10.280 ms 10.142 ms -1.3% no signal
200 x 8 VARCHAR(8000) / full-width ASCII 54.359 ms 50.343 ms -6.0% no signal
5,000 x 8 VARCHAR(8000) / short CP1252 12.991 ms 12.908 ms -1.6% no signal
200 x 8 VARCHAR(8000) / full-width CP1252 50.611 ms 49.720 ms -2.3% no signal
5,000 x 8 VARCHAR(8000) / short UTF-8 (astral) 16.634 ms 16.109 ms -3.5% no signal
200 x 8 VARCHAR(8000) / full-width UTF-8 (astral) 52.301 ms 53.001 ms +1.3% no signal
5,000 x 8 NVARCHAR(4000) / short UTF-16 (astral) 14.388 ms 14.429 ms -0.3% no signal
200 x 8 NVARCHAR(4000) / full-width UTF-16 (astral) 77.760 ms 77.383 ms -2.2% no signal
200,000 x 8 VARCHAR(32) / fetchall control 520.482 ms 497.313 ms -1.8% no signal
200,000 x 8 INT / fetchall control 268.027 ms 264.543 ms -1.3% no signal
10,000 rows x 32 columns / dict(row._mapping) (warm) 30.685 ms 30.735 ms +1.7% no signal
Build and measurement details

ADO build 196324

PR head: b27767c3daaeae96906e2702c5ef3a84190256d1
Base: 504c447b16ccbd36dee3fffa0b620e949f2c4d1d
Measured merge: f7ca863074121df09126d088166fe40420cd8a6a

  • 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: 15183 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: 83.7%
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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants