Skip to content

Commit 1045194

Browse files
authored
Merge pull request #32 from TigerGraph-DevLabs/feature/tigergraph_api
feat: run RESTful APIs directly within TigerGraphX instead of using pyTigerGraph
2 parents c6f0355 + 3517aff commit 1045194

32 files changed

+1157
-573
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
---
44

5+
## 0.2.2
6+
- feat: run RESTful APIs directly within TigerGraphX instead of using pyTigerGraph
7+
58
## 0.2.1
69
- feat: add simple GraphRAG
710
- fix: correct the image link

poetry.lock

Lines changed: 324 additions & 108 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "tigergraphx"
3-
version = "0.2.1"
3+
version = "0.2.2"
44
description = "TigerGraphX is a high-level Python library offering a unified, Python-native interface for graph databases, advanced analytics, and GraphRAG workflows. Combining the simplicity of NetworkX with the advanced capabilities of TigerGraph, including tgCloud, it empowers Python developers to harness the power of graphs without the need to learn query languages like Cypher or GSQL."
55
authors = ["Xuanlei Lin <[email protected]>"]
66
license = "MIT"
@@ -23,7 +23,6 @@ pydantic-settings = "^2.6.1"
2323
pyyaml = "^6.0.2"
2424

2525
# Database and Storage
26-
pytigergraph = "^1.8.1"
2726
nano-vectordb = "^0.0.4.3"
2827

2928
# Large Language Model (LLM) Utilities

tests/integration/core/graph_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ def test_add_node_without_type(self):
169169
):
170170
self.G.add_node("D")
171171

172+
def test_remove_node(self):
173+
assert self.G.remove_node("User_A", "User")
174+
172175
def test_has_nodes(self):
173176
# Test node existence
174177
assert self.G.has_node("User_A", "User")

tests/integration/core/tigervector_test.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,20 @@ def add_nodes_and_edges(self):
5050
self.setup_graph()
5151

5252
# Adding nodes and edges
53+
self.G.upsert(
54+
data=[
55+
{
56+
"id": "Entity_1",
57+
"entity_type": "Person",
58+
"description": "Desc1",
59+
"source_id": "Source1",
60+
"emb_description": [-0.01773, -0.01019, -0.01657],
61+
},
62+
],
63+
node_type="Entity",
64+
)
5365
self.G.add_nodes_from(
5466
[
55-
(
56-
"Entity_1",
57-
{
58-
"entity_type": "Person",
59-
"description": "Desc1",
60-
"source_id": "Source1",
61-
"emb_description": [-0.01773, -0.01019, -0.01657],
62-
},
63-
),
6467
(
6568
"Entity_2",
6669
{

tests/unit/core/managers/data_manager_test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
class TestDataManager:
99
@pytest.fixture(autouse=True)
1010
def setup(self):
11-
self.mock_connection = MagicMock()
12-
self.mock_connection.gsql = MagicMock()
11+
self.mock_tigergraph_api = MagicMock()
12+
self.mock_tigergraph_api.gsql = MagicMock()
1313

1414
mock_context = MagicMock()
15-
mock_context.connection = self.mock_connection # Use the mocked connection
15+
mock_context.tigergraph_api = self.mock_tigergraph_api
1616
mock_context.graph_schema = GraphSchema(
1717
graph_name="MyGraph", nodes={}, edges={}
1818
)
@@ -21,7 +21,7 @@ def setup(self):
2121
def test_load_data_success(self):
2222
loading_job_config = LoadingJobConfig(loading_job_name="test_job", files=[])
2323
# Mock the gsql return value to simulate a successful load process
24-
self.mock_connection.gsql.return_value = (
24+
self.mock_tigergraph_api.gsql.return_value = (
2525
"Using graph 'MyGraph'...\n"
2626
"Successfully created loading jobs:\n"
2727
"LOAD SUCCESSFUL for loading jobid\n"
@@ -30,12 +30,12 @@ def test_load_data_success(self):
3030
self.data_manager.load_data(loading_job_config)
3131

3232
# Assert the gsql method was called once
33-
self.mock_connection.gsql.assert_called_once()
33+
self.mock_tigergraph_api.gsql.assert_called_once()
3434

3535
def test_load_data_failure(self):
3636
loading_job_config = LoadingJobConfig(loading_job_name="test_job", files=[])
3737
# Mock the gsql return value for failure
38-
self.mock_connection.gsql.return_value = "LOAD FAILED"
38+
self.mock_tigergraph_api.gsql.return_value = "LOAD FAILED"
3939

4040
# Assert that RuntimeError is raised on failure
4141
with pytest.raises(RuntimeError):

0 commit comments

Comments
 (0)