Introduce CommunityToolkit.VectorData.SqlServer#16
Conversation
… Testcontainers.MsSql to 4.12.0
There was a problem hiding this comment.
Pull request overview
Introduces a new SQL Server / Azure SQL provider (CommunityToolkit.VectorData.SqlServer) and integrates it into the MEVD solution structure, alongside a new SQL Server conformance test suite to validate provider behavior.
Changes:
- Added
CommunityToolkit.VectorData.SqlServerprovider implementation (collections, command builder, model builder, filter translation, DI extensions). - Added SQL Server conformance tests (including container-backed test store + Azure SQL-specific cases).
- Wired new projects and dependencies into the MEVD solution filter and central package versions.
Reviewed changes
Copilot reviewed 43 out of 43 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| MEVD/test/SqlServer.ConformanceTests/TypeTests/SqlServerKeyTypeTests.cs | SQL Server-specific key type conformance coverage. |
| MEVD/test/SqlServer.ConformanceTests/TypeTests/SqlServerEmbeddingTypeTests.cs | SQL Server-specific embedding type conformance coverage. |
| MEVD/test/SqlServer.ConformanceTests/TypeTests/SqlServerDataTypeTests.cs | SQL Server-specific data type conformance overrides. |
| MEVD/test/SqlServer.ConformanceTests/testsettings.json | Local test configuration for external SQL Server connection strings. |
| MEVD/test/SqlServer.ConformanceTests/Support/SqlServerTestStore.cs | Test store abstraction using Testcontainers or external SQL Server. |
| MEVD/test/SqlServer.ConformanceTests/Support/SqlServerTestEnvironment.cs | Configuration discovery for SQL Server test environment. |
| MEVD/test/SqlServer.ConformanceTests/Support/AzureSqlRequiredAttribute.cs | Helper for gating Azure SQL / Fabric-only tests. |
| MEVD/test/SqlServer.ConformanceTests/SqlServerTestSuiteImplementationTests.cs | Registers ignored base tests for SQL Server test suite. |
| MEVD/test/SqlServer.ConformanceTests/SqlServerIndexKindTests.cs | SQL Server/Azure SQL index-kind test overrides (e.g., DiskANN). |
| MEVD/test/SqlServer.ConformanceTests/SqlServerHybridSearchTests.cs | SQL Server hybrid search test fixture wiring. |
| MEVD/test/SqlServer.ConformanceTests/SqlServerFilterTests.cs | SQL Server filter semantics overrides for null/negation behavior. |
| MEVD/test/SqlServer.ConformanceTests/SqlServerEmbeddingGenerationTests.cs | Embedding generation + DI registration scenarios for SQL Server. |
| MEVD/test/SqlServer.ConformanceTests/SqlServerDistanceFunctionTests.cs | SQL Server distance-function support/exception expectations. |
| MEVD/test/SqlServer.ConformanceTests/SqlServerDependencyInjectionTests.cs | SQL Server DI registration conformance tests. |
| MEVD/test/SqlServer.ConformanceTests/SqlServerCommandBuilderTests.cs | Unit tests for SQL Server command generation/escaping behavior. |
| MEVD/test/SqlServer.ConformanceTests/SqlServerCollectionManagementTests.cs | Collection lifecycle tests wired to SQL Server test store. |
| MEVD/test/SqlServer.ConformanceTests/SqlServer.ConformanceTests.csproj | New conformance test project definition and dependencies. |
| MEVD/test/SqlServer.ConformanceTests/README.md | Docs for running SQL Server conformance tests locally/externally. |
| MEVD/test/SqlServer.ConformanceTests/Properties/AssemblyAttributes.cs | Assembly-level attributes placeholder (license header). |
| MEVD/test/SqlServer.ConformanceTests/ModelTests/SqlServerNoVectorModelTests.cs | Model tests for collections without vectors. |
| MEVD/test/SqlServer.ConformanceTests/ModelTests/SqlServerNoDataModelTests.cs | Model tests for collections without data properties. |
| MEVD/test/SqlServer.ConformanceTests/ModelTests/SqlServerMultiVectorModelTests.cs | Model tests for collections with multiple vectors. |
| MEVD/test/SqlServer.ConformanceTests/ModelTests/SqlServerDynamicModelTests.cs | Model tests for dynamic/dictionary mapping scenarios. |
| MEVD/test/SqlServer.ConformanceTests/ModelTests/SqlServerBasicModelTests.cs | Additional SQL Server-specific behavioral model tests. |
| MEVD/src/SqlServer/SqlServerVectorStoreOptions.cs | Options type for configuring the SQL Server vector store. |
| MEVD/src/SqlServer/SqlServerVectorStore.cs | Vector store implementation for SQL Server/Azure SQL. |
| MEVD/src/SqlServer/SqlServerServiceCollectionExtensions.cs | DI registration extensions for store and collections (keyed + unkeyed). |
| MEVD/src/SqlServer/SqlServerModelBuilder.cs | Model validation/mapping rules for SQL Server-backed collections. |
| MEVD/src/SqlServer/SqlServerMapper.cs | Materialization/mapping from SqlDataReader into record models. |
| MEVD/src/SqlServer/SqlServerJsonSerializerContext.cs | Source-gen JSON context for JSON-mapped property types. |
| MEVD/src/SqlServer/SqlServerFilterTranslator.cs | SQL Server-specific filter SQL translation. |
| MEVD/src/SqlServer/SqlServerDynamicCollection.cs | Dynamic collection specialization for dictionary-backed records. |
| MEVD/src/SqlServer/SqlServerConstants.cs | SQL Server provider constants (limits, names). |
| MEVD/src/SqlServer/SqlServerCommandBuilder.cs | SQL command generation (DDL/DML/search/hybrid search). |
| MEVD/src/SqlServer/SqlServerCollectionOptions.cs | Options type for SQL Server collections (schema, base options). |
| MEVD/src/SqlServer/SqlServerCollection.cs | Collection implementation (CRUD, vector search, hybrid search). |
| MEVD/src/SqlServer/SqlServer.csproj | New provider project definition and packaging metadata. |
| MEVD/src/SqlServer/SqlFilterTranslator.cs | Provider-agnostic filter translation base used by SQL Server translator. |
| MEVD/src/SqlServer/README.md | Provider usage documentation and basic sample. |
| MEVD/src/SqlServer/AssemblyInfo.cs | Assembly-level attributes placeholder (license header). |
| MEVD/MEVD.slnf | Adds SQL Server provider + conformance tests to solution filter. |
| Directory.Packages.props | Adds central versions for SqlClient + Testcontainers.MsSql. |
| CommunityToolkit.AI.slnx | Adds SQL Server provider + conformance tests to solution listing. |
be604ad to
b7b1c5c
Compare
adamsitnik
left a comment
There was a problem hiding this comment.
LGTM, the PR is ready for review.
If you are curious why this PR introduces fewer lines of code than microsoft/DacFx#786
| private const int SqlServerMaxParameters = 2_100; | ||
|
|
||
| [Fact] | ||
| public async Task Split_batches_to_account_for_max_parameter_limit() |
There was a problem hiding this comment.
to other code reviewers: this is one of the very few changes I've made: making this test public, as it was private in the SK repo:
| @@ -0,0 +1,2 @@ | |||
| // Licensed to the .NET Foundation under one or more agreements. | |||
There was a problem hiding this comment.
to other code reviewers: microsoft/DacFx#786 was our source of truth, what we needed was to change the license header from // Copyright (c) Microsoft. All rights reserved.
|
|
||
| ```csharp | ||
| using Microsoft.Extensions.VectorData; | ||
| using CommunityToolkit.VectorData.SqlServer; |
There was a problem hiding this comment.
Another change when compared to microsoft/DacFx#786, the namespace is CommunityToolkit.VectorData.SqlServer rather than Microsoft.SqlServer.VectorData
|
|
||
| <ItemGroup> | ||
| <!-- The HybridSearch tests require running against Azure SQL --> | ||
| <Compile Remove="SqlServerHybridSearchTests.cs" /> |
There was a problem hiding this comment.
To other code reviewers: This is a workaround for dotnet/extensions#7605
There was a problem hiding this comment.
Hmm... It's probably better to not remove the tests entirely, so that they can still run when working locally... If possible, I'd suggest a runtime probe to see whether you're running against Azure, and skipping only if not.
There was a problem hiding this comment.
Isn't this what you did for the index tests below? #16 (comment)
There was a problem hiding this comment.
If possible, I'd suggest a runtime probe to see whether you're running against Azure, and skipping only if not
For these particular class, all methods are non-virtual, so I was not able to find a way to customize them.
I've logged #20 to track this
| public virtual async Task DiskAnn() | ||
| { | ||
| // This test should be conditional (https://github.com/dotnet/extensions/issues/7605) | ||
| if (!await AzureSqlHelper.GetIsAzureSqlAsync()) |
There was a problem hiding this comment.
To other code reviewers: This is a workaround for dotnet/extensions#7605
There was a problem hiding this comment.
Also agree that moving to xunit 3 makes sense. In the SK repo we were using some xunit extensions to allow skipping. See:
https://github.com/microsoft/semantic-kernel/blob/main/dotnet/test/VectorData/AzureAISearch.ConformanceTests/Support/AzureAISearchUrlRequiredAttribute.cs
https://github.com/microsoft/semantic-kernel/blob/main/dotnet/test/VectorData/AzureAISearch.ConformanceTests/Properties/AssemblyAttributes.cs
This was very complex though, and while handy, now that xunit 3 supports all this out of the box, unnecessary.
| public string? Content { get; set; } | ||
|
|
||
| [VectorStoreVector(Dimensions: 1536)] | ||
| public ReadOnlyMemory<float> ContentEmbedding { get; set; } |
There was a problem hiding this comment.
We may want to modernize these examples to use auto embedding generation. See https://learn.microsoft.com/en-us/dotnet/ai/vector-stores/define-your-data-model?tabs=attributes%2Ckey-attribute%2Cdata-attribute%2Cvector-attribute#automatic-embedding-generation-recommended
E.g:
[VectorStoreVector(Dimensions: 1536)]
public string ContentEmbedding => Content;This also requires configuring the vector store with an Embedding Generator, so if too complex for a simple inline example like this, feel free to ignore. And certainly feel free to do this in a follow up PR if you agree with the suggestion.
Ports the
Microsoft.SqlServer.VectorDataprovider and conformance tests from microsoft/DacFx#786 into this repository's MEVD structure.