From 013be621d5a3f674162cb8f17832544815252385 Mon Sep 17 00:00:00 2001 From: yangdx Date: Wed, 2 Apr 2025 14:40:27 +0800 Subject: [PATCH] Remove TiDB storage implementaion --- README-zh.md | 4 ++-- README.md | 4 ++-- config.ini.example | 8 -------- env.example | 12 ++++++------ examples/lightrag_tidb_demo.py | 4 ++++ lightrag/api/README-zh.md | 2 -- lightrag/api/README.md | 2 -- lightrag/kg/__init__.py | 16 ++++++++-------- 8 files changed, 22 insertions(+), 30 deletions(-) diff --git a/README-zh.md b/README-zh.md index 6b8cd550..d8678a93 100644 --- a/README-zh.md +++ b/README-zh.md @@ -1036,8 +1036,8 @@ rag.clear_cache(modes=["local"]) | **参数** | **类型** | **说明** | **默认值** | |--------------|----------|-----------------|-------------| | **working_dir** | `str` | 存储缓存的目录 | `lightrag_cache+timestamp` | -| **kv_storage** | `str` | Storage type for documents and text chunks. Supported types: `JsonKVStorage`,`PGKVStorage`,`RedisKVStorage`,`MongoKVStorage`,`TiDBKVStorage` | `JsonKVStorage` | -| **vector_storage** | `str` | Storage type for embedding vectors. Supported types: `NanoVectorDBStorage`,`PGVectorStorage`,`MilvusVectorDBStorage`,`ChromaVectorDBStorage`,`FaissVectorDBStorage`,`TiDBVectorDBStorage`,`MongoVectorDBStorage`,`QdrantVectorDBStorage` | `NanoVectorDBStorage` | +| **kv_storage** | `str` | Storage type for documents and text chunks. Supported types: `JsonKVStorage`,`PGKVStorage`,`RedisKVStorage`,`MongoKVStorage` | `JsonKVStorage` | +| **vector_storage** | `str` | Storage type for embedding vectors. Supported types: `NanoVectorDBStorage`,`PGVectorStorage`,`MilvusVectorDBStorage`,`ChromaVectorDBStorage`,`FaissVectorDBStorage`,`MongoVectorDBStorage`,`QdrantVectorDBStorage` | `NanoVectorDBStorage` | | **graph_storage** | `str` | Storage type for graph edges and nodes. Supported types: `NetworkXStorage`,`Neo4JStorage`,`PGGraphStorage`,`AGEStorage`,`GremlinStorage` | `NetworkXStorage` | | **doc_status_storage** | `str` | Storage type for documents process status. Supported types: `JsonDocStatusStorage`,`PGDocStatusStorage`,`MongoDocStatusStorage` | `JsonDocStatusStorage` | | **chunk_token_size** | `int` | 拆分文档时每个块的最大令牌大小 | `1200` | diff --git a/README.md b/README.md index 4b3fbd01..b97a251e 100644 --- a/README.md +++ b/README.md @@ -1064,8 +1064,8 @@ Valid modes are: | **Parameter** | **Type** | **Explanation** | **Default** | |--------------|----------|-----------------|-------------| | **working_dir** | `str` | Directory where the cache will be stored | `lightrag_cache+timestamp` | -| **kv_storage** | `str` | Storage type for documents and text chunks. Supported types: `JsonKVStorage`,`PGKVStorage`,`RedisKVStorage`,`MongoKVStorage`,`TiDBKVStorage` | `JsonKVStorage` | -| **vector_storage** | `str` | Storage type for embedding vectors. Supported types: `NanoVectorDBStorage`,`PGVectorStorage`,`MilvusVectorDBStorage`,`ChromaVectorDBStorage`,`FaissVectorDBStorage`,`TiDBVectorDBStorage`,`MongoVectorDBStorage`,`QdrantVectorDBStorage` | `NanoVectorDBStorage` | +| **kv_storage** | `str` | Storage type for documents and text chunks. Supported types: `JsonKVStorage`,`PGKVStorage`,`RedisKVStorage`,`MongoKVStorage` | `JsonKVStorage` | +| **vector_storage** | `str` | Storage type for embedding vectors. Supported types: `NanoVectorDBStorage`,`PGVectorStorage`,`MilvusVectorDBStorage`,`ChromaVectorDBStorage`,`FaissVectorDBStorage`,`MongoVectorDBStorage`,`QdrantVectorDBStorage` | `NanoVectorDBStorage` | | **graph_storage** | `str` | Storage type for graph edges and nodes. Supported types: `NetworkXStorage`,`Neo4JStorage`,`PGGraphStorage`,`AGEStorage`,`GremlinStorage` | `NetworkXStorage` | | **doc_status_storage** | `str` | Storage type for documents process status. Supported types: `JsonDocStatusStorage`,`PGDocStatusStorage`,`MongoDocStatusStorage` | `JsonDocStatusStorage` | | **chunk_token_size** | `int` | Maximum token size per chunk when splitting documents | `1200` | diff --git a/config.ini.example b/config.ini.example index 8829566f..5ff7cfbb 100644 --- a/config.ini.example +++ b/config.ini.example @@ -13,14 +13,6 @@ uri=redis://localhost:6379/1 [qdrant] uri = http://localhost:16333 -[tidb] -host = localhost -port = 4000 -user = your_username -password = your_password -database = your_database -workspace = default # 可选,默认为default - [postgres] host = localhost port = 5432 diff --git a/env.example b/env.example index af4c7f65..3c4ad910 100644 --- a/env.example +++ b/env.example @@ -109,12 +109,12 @@ LIGHTRAG_VECTOR_STORAGE=NanoVectorDBStorage LIGHTRAG_GRAPH_STORAGE=NetworkXStorage LIGHTRAG_DOC_STATUS_STORAGE=JsonDocStatusStorage -### TiDB Configuration -TIDB_HOST=localhost -TIDB_PORT=4000 -TIDB_USER=your_username -TIDB_PASSWORD='your_password' -TIDB_DATABASE=your_database +### TiDB Configuration (Deprecated) +# TIDB_HOST=localhost +# TIDB_PORT=4000 +# TIDB_USER=your_username +# TIDB_PASSWORD='your_password' +# TIDB_DATABASE=your_database ### separating all data from difference Lightrag instances(deprecating) # TIDB_WORKSPACE=default diff --git a/examples/lightrag_tidb_demo.py b/examples/lightrag_tidb_demo.py index 52695560..50eac2ca 100644 --- a/examples/lightrag_tidb_demo.py +++ b/examples/lightrag_tidb_demo.py @@ -1,3 +1,7 @@ +########################################### +# TiDB storage implementation is deprecated +########################################### + import asyncio import os diff --git a/lightrag/api/README-zh.md b/lightrag/api/README-zh.md index aca3d44a..745a15f2 100644 --- a/lightrag/api/README-zh.md +++ b/lightrag/api/README-zh.md @@ -294,7 +294,6 @@ JsonKVStorage JsonFile(默认) PGKVStorage Postgres RedisKVStorage Redis MongoKVStorage MogonDB -TiDBKVStorage TiDB ``` * GRAPH_STORAGE 支持的实现名称 @@ -316,7 +315,6 @@ MilvusVectorDBStorge Milvus ChromaVectorDBStorage Chroma FaissVectorDBStorage Faiss QdrantVectorDBStorage Qdrant -TiDBVectorDBStorage TiDB MongoVectorDBStorage MongoDB ``` diff --git a/lightrag/api/README.md b/lightrag/api/README.md index fdd15008..84efdafc 100644 --- a/lightrag/api/README.md +++ b/lightrag/api/README.md @@ -305,7 +305,6 @@ JsonKVStorage JsonFile(default) PGKVStorage Postgres RedisKVStorage Redis MongoKVStorage MogonDB -TiDBKVStorage TiDB ``` * GRAPH_STORAGE supported implement-name @@ -327,7 +326,6 @@ MilvusVectorDBStorge Milvus ChromaVectorDBStorage Chroma FaissVectorDBStorage Faiss QdrantVectorDBStorage Qdrant -TiDBVectorDBStorage TiDB MongoVectorDBStorage MongoDB ``` diff --git a/lightrag/kg/__init__.py b/lightrag/kg/__init__.py index 445b9e22..77e13c76 100644 --- a/lightrag/kg/__init__.py +++ b/lightrag/kg/__init__.py @@ -4,7 +4,7 @@ STORAGE_IMPLEMENTATIONS = { "JsonKVStorage", "MongoKVStorage", "RedisKVStorage", - "TiDBKVStorage", + # "TiDBKVStorage", "PGKVStorage", ], "required_methods": ["get_by_id", "upsert"], @@ -26,7 +26,7 @@ STORAGE_IMPLEMENTATIONS = { "NanoVectorDBStorage", "MilvusVectorDBStorage", "ChromaVectorDBStorage", - "TiDBVectorDBStorage", + # "TiDBVectorDBStorage", "PGVectorStorage", "FaissVectorDBStorage", "QdrantVectorDBStorage", @@ -50,13 +50,13 @@ STORAGE_ENV_REQUIREMENTS: dict[str, list[str]] = { "JsonKVStorage": [], "MongoKVStorage": [], "RedisKVStorage": ["REDIS_URI"], - "TiDBKVStorage": ["TIDB_USER", "TIDB_PASSWORD", "TIDB_DATABASE"], + # "TiDBKVStorage": ["TIDB_USER", "TIDB_PASSWORD", "TIDB_DATABASE"], "PGKVStorage": ["POSTGRES_USER", "POSTGRES_PASSWORD", "POSTGRES_DATABASE"], # Graph Storage Implementations "NetworkXStorage": [], "Neo4JStorage": ["NEO4J_URI", "NEO4J_USERNAME", "NEO4J_PASSWORD"], "MongoGraphStorage": [], - "TiDBGraphStorage": ["TIDB_USER", "TIDB_PASSWORD", "TIDB_DATABASE"], + # "TiDBGraphStorage": ["TIDB_USER", "TIDB_PASSWORD", "TIDB_DATABASE"], "AGEStorage": [ "AGE_POSTGRES_DB", "AGE_POSTGRES_USER", @@ -72,7 +72,7 @@ STORAGE_ENV_REQUIREMENTS: dict[str, list[str]] = { "NanoVectorDBStorage": [], "MilvusVectorDBStorage": [], "ChromaVectorDBStorage": [], - "TiDBVectorDBStorage": ["TIDB_USER", "TIDB_PASSWORD", "TIDB_DATABASE"], + # "TiDBVectorDBStorage": ["TIDB_USER", "TIDB_PASSWORD", "TIDB_DATABASE"], "PGVectorStorage": ["POSTGRES_USER", "POSTGRES_PASSWORD", "POSTGRES_DATABASE"], "FaissVectorDBStorage": [], "QdrantVectorDBStorage": ["QDRANT_URL"], # QDRANT_API_KEY has default value None @@ -97,9 +97,9 @@ STORAGES = { "MongoVectorDBStorage": ".kg.mongo_impl", "RedisKVStorage": ".kg.redis_impl", "ChromaVectorDBStorage": ".kg.chroma_impl", - "TiDBKVStorage": ".kg.tidb_impl", - "TiDBVectorDBStorage": ".kg.tidb_impl", - "TiDBGraphStorage": ".kg.tidb_impl", + # "TiDBKVStorage": ".kg.tidb_impl", + # "TiDBVectorDBStorage": ".kg.tidb_impl", + # "TiDBGraphStorage": ".kg.tidb_impl", "PGKVStorage": ".kg.postgres_impl", "PGVectorStorage": ".kg.postgres_impl", "AGEStorage": ".kg.age_impl",