-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Feature add tigergraph support #2315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Feature add tigergraph support #2315
Conversation
lightrag/kg/tigergraph_impl.py
Outdated
| def _search_labels(): | ||
| try: | ||
| # Get all vertices and filter | ||
| vertices = self._conn.getVertices(workspace_label, limit=100000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Querying via traversal is inefficient and not recommended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
lightrag/kg/tigergraph_impl.py
Outdated
| def _get_popular_labels(): | ||
| try: | ||
| # Get all vertices and calculate degrees | ||
| vertices = self._conn.getVertices(workspace_label, limit=100000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Querying via traversal is inefficient and not recommended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
lightrag/kg/tigergraph_impl.py
Outdated
| edges_dict[node_id] = edges if edges is not None else [] | ||
| return edges_dict | ||
|
|
||
| async def get_nodes_by_chunk_ids(self, chunk_ids: list[str]) -> list[dict]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_nodes_by_chunk_ids is deprecated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
lightrag/kg/tigergraph_impl.py
Outdated
|
|
||
| return await asyncio.to_thread(_get_nodes_by_chunk_ids) | ||
|
|
||
| async def get_edges_by_chunk_ids(self, chunk_ids: list[str]) -> list[dict]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_edges_by_chunk_ids is deprecated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Related Issues
This PR adds TigerGraph as a new graph storage backend option for LightRAG, expanding the available graph database integrations alongside existing options (Neo4j, Memgraph, PostgreSQL, MongoDB, NetworkX).
Changes Made
1. New TigerGraph Storage Implementation (
lightrag/kg/tigergraph_impl.py)New file: Complete implementation of
TigerGraphStorageclass extendingBaseGraphStorageAll abstract methods implemented:
has_node,get_node,get_nodes_batch,upsert_node,delete_node,remove_nodeshas_edge,get_edge,get_edges_batch,upsert_edge,remove_edgesget_node_edges,get_nodes_edges_batch,get_knowledge_graphnode_degree,node_degrees_batch,edge_degree,edge_degrees_batchget_all_labels,get_popular_labels,search_labelsget_nodes_by_chunk_ids,get_edges_by_chunk_idsget_all_nodes,get_all_edgesinitialize,finalize,index_done_callback,dropKey features:
pyTigerGraphPython driver with async wrappers (asyncio.to_thread)TIGERGRAPH_URItenacityfor write operations2. Storage Registry Updates (
lightrag/kg/__init__.py)TigerGraphStoragetoGRAPH_STORAGEimplementations listTIGERGRAPH_URI,TIGERGRAPH_USERNAME,TIGERGRAPH_PASSWORD"TigerGraphStorage": ".kg.tigergraph_impl"3. Configuration Examples
env.example: Added TigerGraph configuration section with:TIGERGRAPH_URI(default:http://localhost:9000)TIGERGRAPH_USERNAME(default:tigergraph)TIGERGRAPH_PASSWORD(required)TIGERGRAPH_GRAPH_NAME(default:lightrag)TIGERGRAPH_WORKSPACE(optional, for workspace override)config.ini.example: Added[tigergraph]section with corresponding configuration optionsImplementation Details
entity_idas vertex primary key (STRING type)entity_type,description,keywords,source_idwith dynamic attribute supportasyncio.to_thread()for async compatibilityget_data_init_lock()andget_graph_db_lock()for thread-safe initializationChecklist
Additional Notes
Testing Requirements
http://localhost:9000Dependencies
pyTigerGraph:Install viapip install -e ".[offline-storage]"or automatically installed viapipmasterCompatibility
Potential Future Enhancements
Known Limitations
get_nodes_batch) iterate through nodes sequentially due to TigerGraph API limitations