FEAT: Add vector type support coverage and server capability gate - #747
Draft
Gaurav Sharma (bewithgaurav) wants to merge 4 commits into
Draft
FEAT: Add vector type support coverage and server capability gate#747Gaurav Sharma (bewithgaurav) wants to merge 4 commits into
Gaurav Sharma (bewithgaurav) wants to merge 4 commits into
Conversation
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>
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>
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>
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>
📊 Code Coverage Report
Diff CoverageDiff: main...HEAD, staged and unstaged changesNo 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
|
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.
Work Item / Issue Reference
Summary
Adds test coverage and a server capability check for the SQL Server
vectortype.tests/test_027_vector_type.pycontains 28 cases covering round trip, dimensions from 1 to 1998,float32precision,NULLhandling,executemany,VECTOR_DISTANCE, and the rejection paths for oversized dimensions, dimension mismatch, malformed input and thefloat16base type. Two cases confirm that a server without the type refuses it with an ordinary error and leaves the connection usable.conftest.pygains asupports_vectorfixture. 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:
test_002_types.pyandtest_017_spatial_types.pyto confirm the new session scoped fixture does not affect existing tests: 65 passed, 26 skippedblack --line-length=100andflake8cleanTwo notes for the record.
float16is rejected by the server on CU3 with'float16' is not a recognized vector base type, so onlyfloat32is covered.float32precision is visible on read, where3.14159265returns as3.1415927, and the tests pin that rather than work around it.