Skip to content

Add Support for Vector Data Type in SQL for GraphQL#3714

Draft
RubenCerna2079 wants to merge 4 commits into
dev/rubencerna/first-changes-vector-typefrom
dev/rubencerna/vector-support-graphql
Draft

Add Support for Vector Data Type in SQL for GraphQL#3714
RubenCerna2079 wants to merge 4 commits into
dev/rubencerna/first-changes-vector-typefrom
dev/rubencerna/vector-support-graphql

Conversation

@RubenCerna2079

@RubenCerna2079 RubenCerna2079 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Why make this change?

What is this change?

  • In order to allow graphql to read array types that are not [string] we moved the section that parses the scalar values to types hot chocolate can use in order output them to the user. This new CoerceJsonLeafValueToRuntimeType method is then used in a loop to allow support for arrays inside the ExecutionHelper.cs file.
  • In multiple places throughout the code, DAB looks at the SyntaxKind of the values it is working with in order to know if the value can be directly used or if it has a relationship with another entity. In order to allow graphql to write to the data base, we now add a new function TryGetUnderlyingFieldKind in ISqlMetadataProvider.cs that checks if the value is a list and it comes from a row that has the IsArrayType. If that condition is met, then it means the list value we have should be processed as a regular ScalarType and not as a List/Object that is a relationship to a different entity. This method is used in the following files: MultipleMutationInputValidator.cs, MultipleCreateOrderHelper.cs, SqlMutationEnginge.cs.
  • Lastly, as part to allow graphql to write to the data base, we add a new GetStringifiedValue function that checks if the value that we are going to parse to the data base is a list or a regular value and transforms it into a string accordingly. Since we set all values as strings, this is something that cannot be directly done with a list as the .ToString() function will return a useless value. This value is then parsed before being used as a parameter in the data base query.

How was this tested?

  • Integration Tests
  • Unit Tests
    Added tests that query (read) from the data base as well as mutation (change) to the data base such as create, update, and delete.

Sample Request(s)

Query

query {
  dbo_normalvectors {
    items {
      Embedding
      ProductID
    }
  }
}
image

Create

mutation {
  createdbo_normalvector(
    item: { ProductID: 10000, Embedding: [125, 1.22222, 0.75] }
  ) {
    ProductID
    Embedding
  }
}
image

Update

mutation {
  updatedbo_normalvector(
    ProductID: 10000,
    item: { Embedding: [0.532, 200, 100.152] }
  ) {
    ProductID
    Embedding
  }
}
image

Delete

mutation {
  deletedbo_normalvector(
    ProductID: 10000
  ) {
    ProductID
    Embedding
  }
}
image

@RubenCerna2079 RubenCerna2079 changed the base branch from main to dev/rubencerna/first-changes-vector-type July 10, 2026 18:20
@RubenCerna2079 RubenCerna2079 changed the title Dev/rubencerna/vector support graphql Add Support for Vector Data Type in SQL for GraphQL Jul 10, 2026
@RubenCerna2079 RubenCerna2079 added this to the July 2026 milestone Jul 11, 2026
@RubenCerna2079 RubenCerna2079 linked an issue Jul 11, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Add Vector Support for GraphQL

1 participant