{"id":27440,"library":"tcvectordb","title":"Tencent Cloud VectorDB Python SDK","description":"Tencent Cloud VectorDB Python SDK for managing vector databases, including collection creation, data insertion, and similarity search. Current version 2.1.1, requires Python >=3. Monthly releases.","status":"active","version":"2.1.1","language":"python","source_language":"en","source_url":"https://github.com/Tencent/tcvectordb","tags":["tencent","vectordb","sdk","vector-database"],"install":[{"cmd":"pip install tcvectordb","lang":"bash","label":"Install SDK"}],"dependencies":[{"reason":"HTTP client for API calls","package":"requests","optional":false}],"imports":[{"note":"","symbol":"VectorDBClient","correct":"from tcvectordb import VectorDBClient"},{"note":"enums moved to model.enum in v2.x","wrong":"from tcvectordb.enums import ...","symbol":"enums","correct":"from tcvectordb.model.enum import FieldType, IndexType, MetricType"}],"quickstart":{"code":"import os\nfrom tcvectordb import VectorDBClient\nfrom tcvectordb.model.enum import FieldType, IndexType, MetricType\nfrom tcvectordb.model.index import Index, IndexField\n\nclient = VectorDBClient(\n    url=os.environ.get('VECTORDB_URL', ''),\n    username=os.environ.get('VECTORDB_USERNAME', 'root'),\n    key=os.environ.get('VECTORDB_KEY', ''),\n)\ndb = client.create_database('test_db')\nindex = Index(\n    IndexField(name='id', field_type=FieldType.String, primary_key=True),\n    IndexField(name='vector', field_type=FieldType.Vector, dimension=3, index_type=IndexType.HNSW, metric_type=MetricType.COSINE)\n)\ncollection = db.create_collection('test_col', shard=1, replicas=0, index=index)\nprint('Collection created successfully')","lang":"python","description":"Creates a database and collection with HNSW index."},"warnings":[{"fix":"Update imports to use `tcvectordb.model.enum` and follow v2.x API patterns.","message":"In v2.0, the SDK was rewritten; old v1.x code using `import tcvectordb` directly will not work. Enums moved from root to `tcvectordb.model.enum`.","severity":"breaking","affected_versions":"1.x -> 2.x"},{"fix":"Use `Index` class with `IndexField` entries.","message":"`database.create_collection` with `index` parameter as a list of IndexField objects is deprecated; use `tcvectordb.model.index.Index` object.","severity":"deprecated","affected_versions":"< 2.1.0"},{"fix":"Use `key=os.environ.get('VECTORDB_KEY')` when creating VectorDBClient.","message":"The SDK uses `key` parameter for authentication, not `password`. Using `password` will result in silent auth failure.","severity":"gotcha","affected_versions":"all"},{"fix":"Set `url='https://your-endpoint:port'`.","message":"The `url` must include the protocol (https://) and port if non-default. Missing protocol causes connection errors.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `pip install tcvectordb`.","cause":"SDK not installed or installation failed.","error":"ModuleNotFoundError: No module named 'tcvectordb'"},{"fix":"Import from `tcvectordb.model.enum` instead: `from tcvectordb.model.enum import IndexType`.","cause":"Enums were relocated in v2.0.","error":"ImportError: cannot import name 'IndexType' from 'tcvectordb'"},{"fix":"Ensure `username` and `key` are correct. Do not use `password`; use `key`.","cause":"Incorrect username or key, or using password parameter.","error":"tcvectordb.exception.VectorDBException: Authentication failed"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}