Skip to content

[Enh]: Support Vector data type in MSSQL #2767

@JerryNixon

Description

@JerryNixon

Important

The current SQL Client driver in DAB 2.0.x is Microsoft.Data.SqlClient version 5.2.3. 2. SQL Client version 6.1.0 introduces the SqlVector type, extending System.Data.SqlDbTypes. We must upgrade. #3422

Vector data type

In SQL (Azure SQL Database and SQL Server 2025+), the VECTOR datatype is an ordered array of FLOAT32 values (single-precision floating point numbers). Float16 is a coming feature and is outside the scope of this feature.

The goal of this feature is to make VECTOR a first-class supported SQL type in Data API builder (DAB). Tables, views, and stored procedures that contain vector columns or parameters should no longer be excluded from configuration, metadata discovery, or runtime execution.

DAB treats VECTOR like any other supported SQL type such as INT or VARCHAR.

Working sample table

CREATE TABLE embeddings (
    id INT PRIMARY KEY,
    embedding VECTOR(1536)
)

Behavior

Configuration

Note

No configuration changes are required.

DAB discovers vector columns and parameters through normal database metadata inspection.

{
  "entities": {
    "embeddings": {
      "source": {
        "object": "dbo.embeddings",
        "type": "table"
      }
    }
  }
}

Metadata

DAB trusts the metadata reported by the database.

If SQL reports a column or parameter as VECTOR, DAB treats it as a vector.

If SQL reports a different type, DAB treats it as that type.

DAB does not inspect values or attempt to infer vector semantics.

Dimensions

Vector dimensions are treated as an implementation detail.

DAB does not expose vector dimensions through:

  • REST
  • GraphQL
  • MCP
  • OpenAPI

The vector value is represented only as an array of numbers.

Read

GraphQL

query {
  embeddings {
    items {
      id
      embedding
    }
  }
}

GraphQL type

type Embedding {
  id: Int
  embedding: [Float]
}

REST

GET /api/embeddings
Accept: application/json

Response

{
  "value": [
    {
      "id": 1,
      "embedding": [0.01, 0.23, -0.17, 0.56, 0.88]
    },
    {
      "id": 2,
      "embedding": [-0.04, 0.39, 0.27, -0.95, 0.02]
    }
  ]
}

Write

GraphQL

mutation {
  createEmbedding(
    item: {
      id: 3
      embedding: [0.10, 0.45, -0.06, 0.08, -0.23]
    }
  ) {
    id
    embedding
  }
}

REST

POST /api/embeddings
Content-Type: application/json

Request

{
  "id": 3,
  "embedding": [0.10, 0.45, -0.06, 0.08, -0.23]
}

Response

{
  "id": 3,
  "embedding": [0.10, 0.45, -0.06, 0.08, -0.23]
}

Stored procedures

Vector parameters are supported.

SQL

CREATE PROCEDURE SearchEmbeddings
    @embedding VECTOR(1536)
AS
BEGIN
    SELECT *
    FROM embeddings;
END

Request

{
  "embedding": [0.10, 0.45, -0.06, 0.08, -0.23]
}

Stored procedure result sets containing vector columns are also supported.

OpenAPI

Vector columns are represented as arrays of numbers.

{
  "type": "array",
  "items": {
    "type": "number"
  }
}

Null values

Nullable vector columns are supported.

{
  "embedding": null
}

Query behavior

Vector columns participate in normal DAB operations.

Supported operations include:

  • Read
  • Create
  • Update
  • Filter
  • Sort
  • Stored procedure execution

DAB does not introduce vector-specific operators or query semantics.

Query validation remains the responsibility of the database provider.

Docs Info

Vector values can be large.

For example, a VECTOR(1536) column contains 1,536 floating-point values for each row. Large vectors can increase:

  • Response size
  • Network transfer costs
  • Memory consumption
  • Cache utilization
  • GraphQL payload size
  • MCP payload size

Applications should request and return vector values only when required.

Non-goals

The following are outside the scope of this feature:

  • Vector similarity search
  • Vector distance operators
  • Embedding generation
  • Dimension validation
  • Float16 support (this may be automatic)
  • Vector-specific configuration settings
  • Vector-specific GraphQL scalars
  • Vector-specific filtering or sorting behavior

Playground

DROP TABLE IF EXISTS test;

CREATE TABLE test (Id int, Vectr Vector(10));

-- INSERTING

INSERT INTO test (Id, Vectr) VALUES (1, '[1,2,3,4,5,6,7,8,9,10.123]');

SELECT
    c.name,
    c.vector_dimensions
FROM sys.columns AS c
WHERE c.object_id = OBJECT_ID('dbo.test')
  AND c.name = 'Vectr';

/*
name	vector_dimensions
Vectr	10
*/

-- FORMATTING

DECLARE @vector vector(10) = '[1,2,3,4,5,6,7,8,9,10.123]';

-- scientific notation
SELECT CAST(@vector as varchar(max));

/*
[1.0000000e+000,2.0000000e+000,3.0000000e+000,4.0000000e+000,5.0000000e+000,6.0000000e+000,7.0000000e+000,8.0000000e+000,9.0000000e+000,1.0123000e+001]
*/

-- decimal notation
SELECT CAST(CAST(@vector as json) as nvarchar(max));

/*
[1.0000000000,2.0000000000,3.0000000000,4.0000000000,5.0000000000,6.0000000000,7.0000000000,8.0000000000,9.0000000000,10.1230001450]
*/

Metadata

Metadata

No fields configured for Feature.

Projects

Status
In Progress

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions