From 229c087ef5c109a56178f0f2fee5092e106dace6 Mon Sep 17 00:00:00 2001 From: Davide Mauri Date: Mon, 27 Nov 2023 14:05:02 -0800 Subject: [PATCH 1/4] initial support for MSSQL --- .gitattributes | 13 ++ .gitignore | 1 + vectordb_bench/backend/clients/__init__.py | 27 ++- .../backend/clients/mssql/config.py | 48 +++++ vectordb_bench/backend/clients/mssql/mssql.py | 186 ++++++++++++++++++ vectordb_bench/frontend/const/styles.py | 5 +- 6 files changed, 264 insertions(+), 16 deletions(-) create mode 100644 .gitattributes create mode 100644 vectordb_bench/backend/clients/mssql/config.py create mode 100644 vectordb_bench/backend/clients/mssql/mssql.py diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..8efbe82d5 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,13 @@ +# Thanks to: https://rehansaeed.com/gitattributes-best-practices/ + +# Set default behavior to automatically normalize line endings. +* text=auto + +# Force batch scripts to always use CRLF line endings so that if a repo is accessed +# in Windows via a file share from Linux, the scripts will work. +*.{cmd,[cC][mM][dD]} text eol=crlf +*.{bat,[bB][aA][tT]} text eol=crlf + +# Force bash scripts to always use LF line endings so that if a repo is accessed +# in Unix via a file share from Windows, the scripts will work. +*.sh text eol=lf \ No newline at end of file diff --git a/.gitignore b/.gitignore index 004524444..55cc87fa2 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ __MACOSX build/ venv/ .idea/ +.venv/ \ No newline at end of file diff --git a/vectordb_bench/backend/clients/__init__.py b/vectordb_bench/backend/clients/__init__.py index 3df11610b..46e20bd00 100644 --- a/vectordb_bench/backend/clients/__init__.py +++ b/vectordb_bench/backend/clients/__init__.py @@ -29,14 +29,17 @@ class DB(Enum): QdrantCloud = "QdrantCloud" WeaviateCloud = "WeaviateCloud" PgVector = "PgVector" - PgVectoRS = "PgVectoRS" Redis = "Redis" Chroma = "Chroma" - + MSSQL = "MSSQL" @property def init_cls(self) -> Type[VectorDB]: """Import while in use""" + if self == DB.MSSQL: + from .mssql.mssql import MSSQL + return MSSQL + if self == DB.Milvus: from .milvus.milvus import Milvus return Milvus @@ -65,10 +68,6 @@ def init_cls(self) -> Type[VectorDB]: from .pgvector.pgvector import PgVector return PgVector - if self == DB.PgVectoRS: - from .pgvecto_rs.pgvecto_rs import PgVectoRS - return PgVectoRS - if self == DB.Redis: from .redis.redis import Redis return Redis @@ -80,6 +79,10 @@ def init_cls(self) -> Type[VectorDB]: @property def config_cls(self) -> Type[DBConfig]: """Import while in use""" + if self == DB.MSSQL: + from .mssql.config import MSSQLConfig + return MSSQLConfig + if self == DB.Milvus: from .milvus.config import MilvusConfig return MilvusConfig @@ -108,10 +111,6 @@ def config_cls(self) -> Type[DBConfig]: from .pgvector.config import PgVectorConfig return PgVectorConfig - if self == DB.PgVectoRS: - from .pgvecto_rs.config import PgVectoRSConfig - return PgVectoRSConfig - if self == DB.Redis: from .redis.config import RedisConfig return RedisConfig @@ -121,6 +120,10 @@ def config_cls(self) -> Type[DBConfig]: return ChromaConfig def case_config_cls(self, index_type: IndexType | None = None) -> Type[DBCaseConfig]: + if self == DB.MSSQL: + from .mssql.config import MSSQLVectorIndexConfig + return MSSQLVectorIndexConfig + if self == DB.Milvus: from .milvus.config import _milvus_case_config return _milvus_case_config.get(index_type) @@ -145,10 +148,6 @@ def case_config_cls(self, index_type: IndexType | None = None) -> Type[DBCaseCon from .pgvector.config import PgVectorIndexConfig return PgVectorIndexConfig - if self == DB.PgVectoRS: - from .pgvecto_rs.config import _pgvecto_rs_case_config - return _pgvecto_rs_case_config.get(index_type) - # DB.Pinecone, DB.Chroma, DB.Redis return EmptyDBCaseConfig diff --git a/vectordb_bench/backend/clients/mssql/config.py b/vectordb_bench/backend/clients/mssql/config.py new file mode 100644 index 000000000..8ebb55106 --- /dev/null +++ b/vectordb_bench/backend/clients/mssql/config.py @@ -0,0 +1,48 @@ +from pydantic import BaseModel, SecretStr +from ..api import DBConfig, DBCaseConfig, MetricType + +MSSQL_CONNECTION_STRING_PLACEHOLDER="DRIVER={ODBC Driver 18 for SQL Server};SERVER=%s;DATABASE=%s;UID=%s;PWD=%s;Connect Timeout=30;" + +class MSSQLConfig(DBConfig): + server: str + database: str + uid: str + pwd: SecretStr + + def to_dict(self) -> dict: + pwd_str = self.pwd.get_secret_value() + return { + "connection_string" : MSSQL_CONNECTION_STRING_PLACEHOLDER%(self.server, self.database, self.uid, pwd_str) + } + + +class MSSQLVectorIndexConfig(BaseModel, DBCaseConfig): + metric_type: MetricType | None = None + lists: int | None = 1000 + probes: int | None = 10 + + def parse_metric(self) -> str: + if self.metric_type == MetricType.L2: + return "vector_l2_ops" + elif self.metric_type == MetricType.IP: + return "vector_ip_ops" + return "vector_cosine_ops" + + def parse_metric_fun_str(self) -> str: + if self.metric_type == MetricType.L2: + return "l2_distance" + elif self.metric_type == MetricType.IP: + return "max_inner_product" + return "cosine_distance" + + def index_param(self) -> dict: + return { + "lists" : self.lists, + "metric" : self.parse_metric() + } + + def search_param(self) -> dict: + return { + "probes" : self.probes, + "metric_fun" : self.parse_metric_fun_str() + } \ No newline at end of file diff --git a/vectordb_bench/backend/clients/mssql/mssql.py b/vectordb_bench/backend/clients/mssql/mssql.py new file mode 100644 index 000000000..f1f880623 --- /dev/null +++ b/vectordb_bench/backend/clients/mssql/mssql.py @@ -0,0 +1,186 @@ +"""Wrapper around the Azure SQL""" + +import logging +from contextlib import contextmanager +from typing import Any + +from ..api import VectorDB, DBCaseConfig + +import pyodbc +import json + +log = logging.getLogger(__name__) + +class MSSQL(VectorDB): + def __init__( + self, + dim: int, + db_config: dict, + db_case_config: DBCaseConfig, + collection_name: str = "vector", + drop_old: bool = False, + **kwargs, + ): + self.db_config = db_config + self.case_config = db_case_config + self.table_name = collection_name + "_" + str(dim) + self.dim = dim + self.schema_name = "benchmark" + + log.info("db_case_config: " + str(db_case_config)) + + log.info(f"Connecting to MSSQL...") + cnxn = pyodbc.connect(self.db_config['connection_string']) + cursor = cnxn.cursor() + + log.info(f"Creating schema...") + cursor.execute(f""" + if (schema_id('{self.schema_name}') is null) begin + exec('create schema [{self.schema_name}] authorization [dbo];') + end; + """) + cnxn.commit() + + # if drop_old: + # log.info(f"Dropping existing tables...") + # cursor.execute(f""" + # drop table if exists [{self.schema_name}].[{self.table_name}] + # """) + # cursor.execute(f""" + # drop table if exists [{self.schema_name}].[{self.table_name}_index] + # """) + # cnxn.commit() + + # log.info(f"Creating vector table...") + # cursor.execute(f""" + # create table [{self.schema_name}].[{self.table_name}] ( + # id int primary key, + # vector nvarchar(max) check(isjson(vector)=1) + # ) + # """) + # cnxn.commit() + + # log.info(f"Creating vector values (index) table...") + # cursor.execute(f""" + # create table [{self.schema_name}].[{self.table_name}_index] + # ( + # vector_id int not null, + # vector_value_id smallint not null, + # vector_value float not null + # ) + # """) + # cnxn.commit() + + # log.info(f"Creating columnstore index...") + # cursor.execute(f""" + # create clustered columnstore index cci_{self.table_name} on [{self.schema_name}].[{self.table_name}_index] + # """) + # cnxn.commit() + + cursor.close() + cnxn.close() + + @contextmanager + def init(self) -> None: + cnxn = pyodbc.connect(self.db_config['connection_string']) + self.cnxn = cnxn + cnxn.autocommit = False + yield + self.cnxn.close() + + def ready_to_load(self): + log.info(f"MSSQL ready to load") + pass + + def optimize(self): + log.info(f"MSSQL optimize") + pass + + def ready_to_search(self): + log.info(f"MSSQL ready to search") + pass + + def insert_embeddings( + self, + embeddings: list[list[float]], + metadata: list[int], + **kwargs: Any, + ) -> (int, Exception): + try: + log.info(f'Loading batch of {len(metadata)} vectors...') + return len(metadata), None + + log.info(f'Truncating staging table...') + cursor = self.cnxn.cursor() + cursor.fast_executemany = True + cursor.execute(f"truncate table [{self.schema_name}].[{self.table_name}]") + cursor.commit() + + log.info(f'Generating param list...') + params = [(metadata[i], str(embeddings[i])) for i in range(len(metadata))] + # params = list() + # for i in range(0, len(metadata)): + # params.append((metadata[i], str(embeddings[i]))) + + log.info(f'Loading staging table...') + cursor.executemany(f"insert into [{self.schema_name}].[{self.table_name}] (id, vector) values (?, ?)", params) + cursor.commit() + + log.info(f'Loading vector index table...') + cursor.execute(f""" + insert into + [{self.schema_name}].[{self.table_name}_index] + select + v.id as [vector_id], + cast([key] as int) as [vector_value_id], + cast([value] as float) as [vector_value] + from + [{self.schema_name}].[{self.table_name}] v + cross apply + openjson([vector]) + """) + cursor.commit() + + return len(metadata), None + except Exception as e: + #cursor.rollback() + log.warning(f"Failed to insert data into vector table ([{self.schema_name}].[{self.table_name}]), error: {e}") + return 0, e + + def search_embedding( + self, + query: list[float], + k: int = 100, + filters: dict | None = None, + timeout: int | None = None, + ) -> list[int]: + log.info(f'Query {k} {filters} {timeout}...') + cursor = self.cnxn.cursor() + cursor.execute(f""" + with cteVector as + ( + select + cast([key] as int) as [vector_value_id], + cast([value] as float) as [vector_value] + from + (values (?)) v(vector) + cross apply + openjson([vector]) + ) + select top({k}) + v2.vector_id, + sum(v1.[vector_value] * v2.[vector_value]) as cosine_similarity + from + cteVector v1 + inner join + [{self.schema_name}].[{self.table_name}_index] v2 on v1.vector_value_id = v2.vector_value_id + group by + v2.vector_id + order by + cosine_similarity desc + """, str(query)) + rows = cursor.fetchall() + res = [row.vector_id for row in rows] + return list(res) + + \ No newline at end of file diff --git a/vectordb_bench/frontend/const/styles.py b/vectordb_bench/frontend/const/styles.py index 52d1017a9..22017734a 100644 --- a/vectordb_bench/frontend/const/styles.py +++ b/vectordb_bench/frontend/const/styles.py @@ -43,9 +43,9 @@ def getPatternShape(i): DB.QdrantCloud: "https://assets.zilliz.com/qdrant_b691674fcd.png", DB.WeaviateCloud: "https://assets.zilliz.com/weaviate_4f6f171ebe.png", DB.PgVector: "https://assets.zilliz.com/PG_Vector_d464f2ef5f.png", - DB.PgVectoRS: "https://assets.zilliz.com/PG_Vector_d464f2ef5f.png", DB.Redis: "https://assets.zilliz.com/Redis_Cloud_74b8bfef39.png", - DB.Chroma: "https://assets.zilliz.com/chroma_ceb3f06ed7.png", + DB.Chroma: "https://assets.zilliz.com/chroma_ceb3f06ed7.png", + DB.MSSQL: "https://azuresql.dev/assets/azure-sql-db-100x100.png", } # RedisCloud color: #0D6EFD @@ -59,4 +59,5 @@ def getPatternShape(i): DB.WeaviateCloud.value: "#20C997", DB.PgVector.value: "#4C779A", DB.Redis.value: "#0D6EFD", + DB.MSSQL.value: "#4C779A", } From 4dee798fe330d70c2eacc127e1baff7eb87818c3 Mon Sep 17 00:00:00 2001 From: Davide Mauri Date: Mon, 27 Nov 2023 14:51:07 -0800 Subject: [PATCH 2/4] updated MSSQL test --- .../frontend/const/dbCaseConfigs.py | 69 +------------------ vectordb_bench/models.py | 5 +- 2 files changed, 4 insertions(+), 70 deletions(-) diff --git a/vectordb_bench/frontend/const/dbCaseConfigs.py b/vectordb_bench/frontend/const/dbCaseConfigs.py index 1298983ff..bff623bb0 100644 --- a/vectordb_bench/frontend/const/dbCaseConfigs.py +++ b/vectordb_bench/frontend/const/dbCaseConfigs.py @@ -24,7 +24,7 @@ CaseType.Performance768D1M1P, DIVIDER, CaseType.Performance1536D5M1P, - CaseType.Performance1536D500K1P, + CaseType.Performance1536D500K1P, DIVIDER, CaseType.Performance768D10M99P, CaseType.Performance768D1M99P, @@ -111,18 +111,6 @@ class CaseConfigInput(BaseModel): }, ) -CaseConfigParamInput_EFConstruction_PgVectoRS = CaseConfigInput( - label=CaseConfigParamType.EFConstruction, - inputType=InputType.Number, - inputConfig={ - "min": 8, - "max": 512, - "value": 360, - }, - isDisplayed=lambda config: config[CaseConfigParamType.IndexType] - == IndexType.HNSW.value, -) - CaseConfigParamInput_M_ES = CaseConfigInput( label=CaseConfigParamType.M, inputType=InputType.Number, @@ -227,23 +215,6 @@ class CaseConfigInput(BaseModel): }, ) -CaseConfigParamInput_QuantizationType_PgVectoRS = CaseConfigInput( - label=CaseConfigParamType.quantizationType, - inputType=InputType.Option, - inputConfig={ - "options": ["trivial", "scalar", "product"], - }, -) - -CaseConfigParamInput_QuantizationRatio_PgVectoRS = CaseConfigInput( - label=CaseConfigParamType.quantizationRatio, - inputType=InputType.Option, - inputConfig={ - "options": ["x4", "x8", "x16", "x32", "x64"], - }, - isDisplayed=lambda config: config.get(CaseConfigParamType.quantizationType, None) - == "product", -) MilvusLoadConfig = [ CaseConfigParamInput_IndexType, @@ -281,25 +252,6 @@ class CaseConfigInput(BaseModel): PgVectorLoadingConfig = [CaseConfigParamInput_Lists] PgVectorPerformanceConfig = [CaseConfigParamInput_Lists, CaseConfigParamInput_Probes] -PgVectoRSLoadingConfig = [ - CaseConfigParamInput_IndexType, - CaseConfigParamInput_M, - CaseConfigParamInput_EFConstruction_PgVectoRS, - CaseConfigParamInput_Nlist, - CaseConfigParamInput_QuantizationType_PgVectoRS, - CaseConfigParamInput_QuantizationRatio_PgVectoRS, -] - -PgVectoRSPerformanceConfig = [ - CaseConfigParamInput_IndexType, - CaseConfigParamInput_M, - CaseConfigParamInput_EFConstruction_PgVectoRS, - CaseConfigParamInput_Nlist, - CaseConfigParamInput_Nprobe, - CaseConfigParamInput_QuantizationType_PgVectoRS, - CaseConfigParamInput_QuantizationRatio_PgVectoRS, -] - CASE_CONFIG_MAP = { DB.Milvus: { CaseType.CapacityDim960: MilvusLoadConfig, @@ -316,7 +268,7 @@ class CaseConfigInput(BaseModel): CaseType.Performance1536D5M1P: MilvusPerformanceConfig, CaseType.Performance1536D500K1P: MilvusPerformanceConfig, CaseType.Performance1536D5M99P: MilvusPerformanceConfig, - CaseType.Performance1536D500K99P: MilvusPerformanceConfig, + CaseType.Performance1536D500K99P: MilvusPerformanceConfig, }, DB.WeaviateCloud: { CaseType.CapacityDim960: WeaviateLoadConfig, @@ -369,21 +321,4 @@ class CaseConfigInput(BaseModel): CaseType.Performance1536D5M99P: PgVectorPerformanceConfig, CaseType.Performance1536D500K99P: PgVectorPerformanceConfig, }, - DB.PgVectoRS: { - CaseType.CapacityDim960: PgVectoRSLoadingConfig, - CaseType.CapacityDim128: PgVectoRSLoadingConfig, - CaseType.Performance768D100M: PgVectoRSPerformanceConfig, - CaseType.Performance768D10M: PgVectoRSPerformanceConfig, - CaseType.Performance768D1M: PgVectoRSPerformanceConfig, - CaseType.Performance768D10M1P: PgVectoRSPerformanceConfig, - CaseType.Performance768D1M1P: PgVectoRSPerformanceConfig, - CaseType.Performance768D10M99P: PgVectoRSPerformanceConfig, - CaseType.Performance768D1M99P: PgVectoRSPerformanceConfig, - CaseType.Performance1536D5M: PgVectoRSPerformanceConfig, - CaseType.Performance1536D500K: PgVectoRSPerformanceConfig, - CaseType.Performance1536D5M1P: PgVectoRSPerformanceConfig, - CaseType.Performance1536D500K1P: PgVectoRSPerformanceConfig, - CaseType.Performance1536D5M99P: PgVectorPerformanceConfig, - CaseType.Performance1536D500K99P: PgVectoRSPerformanceConfig, - }, } diff --git a/vectordb_bench/models.py b/vectordb_bench/models.py index 2f9575db3..4e32181b4 100644 --- a/vectordb_bench/models.py +++ b/vectordb_bench/models.py @@ -24,11 +24,11 @@ class LoadTimeoutError(TimeoutError): pass - class PerformanceTimeoutError(TimeoutError): pass + class CaseConfigParamType(Enum): """ Value will be the key of CaseConfig.params and displayed in UI @@ -45,8 +45,6 @@ class CaseConfigParamType(Enum): numCandidates = "num_candidates" lists = "lists" probes = "probes" - quantizationType = "quantizationType" - quantizationRatio = "quantizationRatio" class CustomizedCase(BaseModel): @@ -106,6 +104,7 @@ def flush(self): db=db.value.lower(), ) + def get_db_results(self) -> dict[DB, CaseResult]: db2case = {} for res in self.results: From 65142a50f351c840fc62252133147f49d659063c Mon Sep 17 00:00:00 2001 From: Davide Mauri Date: Mon, 27 Nov 2023 15:24:20 -0800 Subject: [PATCH 3/4] added MSSQL --- pyproject.toml | 3 +++ vectordb_bench/backend/clients/mssql/mssql.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f73bc2940..a90b0679b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,6 +54,7 @@ all = [ "redis", "chromadb", "psycopg2", + "pyodbc" ] qdrant = [ "qdrant-client" ] @@ -64,6 +65,7 @@ pgvector = [ "pgvector", "sqlalchemy" ] pgvecto_rs = [ "psycopg2" ] redis = [ "redis" ] chromadb = [ "chromadb" ] +mssql = [ "pyodbc" ] [project.urls] "repository" = "https://github.com/zilliztech/VectorDBBench" @@ -72,3 +74,4 @@ chromadb = [ "chromadb" ] init_bench = "vectordb_bench.__main__:main" [tool.setuptools_scm] + diff --git a/vectordb_bench/backend/clients/mssql/mssql.py b/vectordb_bench/backend/clients/mssql/mssql.py index f1f880623..4c7a88bcb 100644 --- a/vectordb_bench/backend/clients/mssql/mssql.py +++ b/vectordb_bench/backend/clients/mssql/mssql.py @@ -1,4 +1,4 @@ -"""Wrapper around the Azure SQL""" +"""Wrapper around MSSQL""" import logging from contextlib import contextmanager From caacfe93e600a65a11cc90e5c40a341d2d4cbef1 Mon Sep 17 00:00:00 2001 From: Davide Mauri Date: Thu, 11 Jan 2024 11:48:04 -0800 Subject: [PATCH 4/4] drop old --- vectordb_bench/backend/clients/mssql/mssql.py | 112 +++++++++--------- 1 file changed, 57 insertions(+), 55 deletions(-) diff --git a/vectordb_bench/backend/clients/mssql/mssql.py b/vectordb_bench/backend/clients/mssql/mssql.py index 4c7a88bcb..6ee22bf3d 100644 --- a/vectordb_bench/backend/clients/mssql/mssql.py +++ b/vectordb_bench/backend/clients/mssql/mssql.py @@ -41,41 +41,41 @@ def __init__( """) cnxn.commit() - # if drop_old: - # log.info(f"Dropping existing tables...") - # cursor.execute(f""" - # drop table if exists [{self.schema_name}].[{self.table_name}] - # """) - # cursor.execute(f""" - # drop table if exists [{self.schema_name}].[{self.table_name}_index] - # """) - # cnxn.commit() - - # log.info(f"Creating vector table...") - # cursor.execute(f""" - # create table [{self.schema_name}].[{self.table_name}] ( - # id int primary key, - # vector nvarchar(max) check(isjson(vector)=1) - # ) - # """) - # cnxn.commit() - - # log.info(f"Creating vector values (index) table...") - # cursor.execute(f""" - # create table [{self.schema_name}].[{self.table_name}_index] - # ( - # vector_id int not null, - # vector_value_id smallint not null, - # vector_value float not null - # ) - # """) - # cnxn.commit() - - # log.info(f"Creating columnstore index...") - # cursor.execute(f""" - # create clustered columnstore index cci_{self.table_name} on [{self.schema_name}].[{self.table_name}_index] - # """) - # cnxn.commit() + if drop_old: + log.info(f"Dropping existing tables...") + cursor.execute(f""" + drop table if exists [{self.schema_name}].[{self.table_name}] + """) + cursor.execute(f""" + drop table if exists [{self.schema_name}].[{self.table_name}_index] + """) + cnxn.commit() + + log.info(f"Creating vector table...") + cursor.execute(f""" + create table [{self.schema_name}].[{self.table_name}] ( + id int primary key, + vector nvarchar(max) check(isjson(vector)=1) + ) + """) + cnxn.commit() + + log.info(f"Creating vector values (index) table...") + cursor.execute(f""" + create table [{self.schema_name}].[{self.table_name}_index] + ( + vector_id int not null, + vector_value_id smallint not null, + vector_value float not null + ) + """) + cnxn.commit() + + log.info(f"Creating columnstore index...") + cursor.execute(f""" + create clustered columnstore index cci_{self.table_name} on [{self.schema_name}].[{self.table_name}_index] + """) + cnxn.commit() cursor.close() cnxn.close() @@ -108,13 +108,13 @@ def insert_embeddings( ) -> (int, Exception): try: log.info(f'Loading batch of {len(metadata)} vectors...') - return len(metadata), None + #return len(metadata), None - log.info(f'Truncating staging table...') - cursor = self.cnxn.cursor() - cursor.fast_executemany = True - cursor.execute(f"truncate table [{self.schema_name}].[{self.table_name}]") - cursor.commit() + + # log.info(f'Truncating staging table...') + # cursor.fast_executemany = True + # cursor.execute(f"truncate table [{self.schema_name}].[{self.table_name}]") + # cursor.commit() log.info(f'Generating param list...') params = [(metadata[i], str(embeddings[i])) for i in range(len(metadata))] @@ -123,23 +123,25 @@ def insert_embeddings( # params.append((metadata[i], str(embeddings[i]))) log.info(f'Loading staging table...') + cursor = self.cnxn.cursor() + cursor.fast_executemany = True cursor.executemany(f"insert into [{self.schema_name}].[{self.table_name}] (id, vector) values (?, ?)", params) cursor.commit() - log.info(f'Loading vector index table...') - cursor.execute(f""" - insert into - [{self.schema_name}].[{self.table_name}_index] - select - v.id as [vector_id], - cast([key] as int) as [vector_value_id], - cast([value] as float) as [vector_value] - from - [{self.schema_name}].[{self.table_name}] v - cross apply - openjson([vector]) - """) - cursor.commit() + # log.info(f'Loading vector index table...') + # cursor.execute(f""" + # insert into + # [{self.schema_name}].[{self.table_name}_index] + # select + # v.id as [vector_id], + # cast([key] as int) as [vector_value_id], + # cast([value] as float) as [vector_value] + # from + # [{self.schema_name}].[{self.table_name}] v + # cross apply + # openjson([vector]) + # """) + # cursor.commit() return len(metadata), None except Exception as e: