EnumEncoder
default
TiDBStorage
BaseVectorStorage for interacting with TiDB.
The detailed information about TiDB is available at:
TiDB Vector Search <https://pingcap.com/ai>_
Parameters:
- vector_dim (int): The dimension of storing vectors.
- url_and_api_key (Optional[Union[Tuple[str, str], str]]): A tuple containing the database url and API key for connecting to a TiDB cluster. The URL should be in the format: “mysql+pymysql://
<username>:<password>@<host>:<port>/<db_name>”. TiDB will not use the API Key, but retains the definition for interface compatible. - collection_name (Optional[str]): Name of the collection. The collection name will be used as the table name in TiDB. If not provided, set it to the current time with iso format. **kwargs (Any): Additional keyword arguments for initializing TiDB connection.
init
_create_client
- database_url (Optional[str]): The database connection string for the TiDB server. **kwargs: Additional keyword arguments passed to the TiDB client.
_get_table_model
_open_and_create_table
_check_table
_generate_table_name
_get_table_info
_validate_and_convert_vectors
- records (List[VectorRecord]): List of vector records to validate and convert.
add
- records (List[VectorRecord]): List of vectors to be added. **kwargs (Any): Additional keyword arguments pass to insert.
delete
- ids (List[str]): List of unique identifiers for the vectors to be deleted. **kwargs (Any): Additional keyword arguments passed to delete.
status
query
- query (VectorDBQuery): The query object containing the search vector and the number of top similar vectors to retrieve. **kwargs (Any): Additional keyword arguments passed to search.