Skip to content

FEAT: Add vector type support coverage and server capability gate - #747

Draft
Gaurav Sharma (bewithgaurav) wants to merge 4 commits into
mainfrom
bewithgaurav/document-vector-support
Draft

FEAT: Add vector type support coverage and server capability gate#747
Gaurav Sharma (bewithgaurav) wants to merge 4 commits into
mainfrom
bewithgaurav/document-vector-support

Conversation

@bewithgaurav

@bewithgaurav Gaurav Sharma (bewithgaurav) commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Work Item / Issue Reference

ADO Work Item: Fixed AB#41558


Summary

Adds test coverage and a server capability check for the SQL Server vector type.

tests/test_027_vector_type.py contains 28 cases covering round trip, dimensions from 1 to 1998, float32 precision, NULL handling, executemany, VECTOR_DISTANCE, and the rejection paths for oversized dimensions, dimension mismatch, malformed input and the float16 base type. Two cases confirm that a server without the type refuses it with an ordinary error and leaves the connection usable.

conftest.py gains a supports_vector fixture. It checks for the type by attempting a cast rather than by reading a version banner, so a backend is classified by what it supports rather than by what a version string implies. Tests gate on it in both directions, so legs running older servers skip instead of failing. The fixture is reusable for future work that depends on server capability.

Also adds a changelog entry and removes the vector row from the roadmap, since the type is supported rather than planned.

Validation

Verified against SQL Server 2025 CU3 and SQL Server 2022 CU18 on driver 18.6.2.1:

  • SQL Server 2025: 26 passed, 2 skipped
  • SQL Server 2022: 2 passed, 26 skipped, the exact mirror
  • Run alongside test_002_types.py and test_017_spatial_types.py to confirm the new session scoped fixture does not affect existing tests: 65 passed, 26 skipped
  • black --line-length=100 and flake8 clean

Two notes for the record. float16 is rejected by the server on CU3 with 'float16' is not a recognized vector base type, so only float32 is covered. float32 precision is visible on read, where 3.14159265 returns as 3.1415927, and the tests pin that rather than work around it.

The SQL Server 2025 vector type is already usable through the driver by passing a JSON array string and converting it server side with CAST, but nothing in the repo said so. Adds a README section showing the read and write pattern, the supported dimension range, the float32 precision caveat and the behaviour on servers without the type, and updates the roadmap row to reflect that native binding is still outstanding.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added the pr-size: small Minimal code update label Sep 3, 2026
Adds tests/test_027_vector_type.py covering the json array string path for the sql server 2025 vector type: round trip, dimensions from 1 to 1998, the float32 precision boundary, nulls, executemany, VECTOR_DISTANCE, and the rejection paths for oversized dimensions, dimension mismatch, malformed input and the float16 base type. Also asserts the connection survives a rejected vector statement.

Adds a supports_vector fixture to conftest that probes for the type with a cast rather than reading a version banner, so backends that gained the type on their own schedule are classified by what they actually support. Tests gate on it in both directions, which keeps the sql server 2022 and localdb legs skipping instead of failing.

Trims the earlier readme section to a short key features entry pointing at the wiki, and keeps the roadmap row marked in progress since native binding is still outstanding.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added pr-size: medium Moderate update size and removed pr-size: small Minimal code update labels Sep 3, 2026
@bewithgaurav Gaurav Sharma (bewithgaurav) changed the title DOC: document vector type usage and update roadmap status FEAT: add vector type support coverage and server capability gate Sep 3, 2026
Reverts both readme sections added earlier in this branch. Data type detail belongs in the wiki, not on the landing page, and the key features section is about driver level capabilities rather than individual types.

Removes the vector row from the roadmap. The type is usable and now covered by tests, so it is no longer a planned feature. Native binding through SQL_C_SS_VECTOR remains tracked in ADO rather than as a public roadmap promise with a date attached.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bewithgaurav Gaurav Sharma (bewithgaurav) changed the title FEAT: add vector type support coverage and server capability gate FEAT: Add vector type support coverage and server capability gate Sep 3, 2026
Records under Unreleased/Added that the SQL Server 2025 vector type is usable, how values are written and read, which backends provide it, and the float32 base type, dimension and precision limits. States that native binding is still outstanding so values are exchanged as strings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

📊 Code Coverage Report

🔥 Diff Coverage

100%


🎯 Overall Coverage

82%


📈 Total Lines Covered: 7804 out of 9478
📁 Project: mssql-python


Diff Coverage

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

No lines with coverage information in this diff.


📋 Files Needing Attention

📉 Files with overall lowest coverage (click to expand)
mssql_python.pybind.logger_bridge.cpp: 58.9%
mssql_python.pybind.ddbc_bindings.h: 61.5%
mssql_python.pybind.logger_bridge.hpp: 70.8%
mssql_python.pybind.ddbc_bindings.cpp: 75.5%
mssql_python.__init__.py: 77.6%
mssql_python.row.py: 77.6%
mssql_python.pybind.connection.connection_pool.cpp: 81.6%
mssql_python.pybind.connection.connection.cpp: 84.4%
mssql_python.logging.py: 85.5%
mssql_python.connection.py: 85.9%

🔗 Quick Links

⚙️ Build Summary 📋 Coverage Details

View Azure DevOps Build

Browse Full Coverage Report

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

Labels

pr-size: medium Moderate update size

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants