-
Notifications
You must be signed in to change notification settings - Fork 78
fix: can't query vertex with number vertex id #329
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?
Changes from all commits
e8b942b
a4dea65
5608e87
acf47f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,7 +32,7 @@ dependencies = [ | |
| "requests", | ||
| "setuptools", | ||
| "urllib3", | ||
| "rich", | ||
| "rich" | ||
| ] | ||
|
|
||
| [project.urls] | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -45,21 +45,21 @@ def addVertices(self, input_data): | |||||
| return [VertexData({"id": item}) for item in response] | ||||||
| return None | ||||||
|
|
||||||
| @router.http("PUT", 'graph/vertices/"{vertex_id}"?action=append') | ||||||
| @router.http("PUT", 'graph/vertices/{vertex_id}?action=append') | ||||||
| def appendVertex(self, vertex_id, properties): # pylint: disable=unused-argument | ||||||
| data = {"properties": properties} | ||||||
| if response := self._invoke_request(data=json.dumps(data)): | ||||||
| return VertexData(response) | ||||||
| return None | ||||||
|
|
||||||
| @router.http("PUT", 'graph/vertices/"{vertex_id}"?action=eliminate') | ||||||
| @router.http("PUT", 'graph/vertices/{vertex_id}?action=eliminate') | ||||||
| def eliminateVertex(self, vertex_id, properties): # pylint: disable=unused-argument | ||||||
| data = {"properties": properties} | ||||||
| if response := self._invoke_request(data=json.dumps(data)): | ||||||
| return VertexData(response) | ||||||
| return None | ||||||
|
|
||||||
| @router.http("GET", 'graph/vertices/"{vertex_id}"') | ||||||
| @router.http("GET", 'graph/vertices/{vertex_id}') | ||||||
| def getVertexById(self, vertex_id): # pylint: disable=unused-argument | ||||||
| if response := self._invoke_request(): | ||||||
| return VertexData(response) | ||||||
|
|
@@ -101,7 +101,7 @@ def getVertexByCondition(self, label="", limit=0, page=None, properties=None): | |||||
| return [VertexData(item) for item in response["vertices"]] | ||||||
| return None | ||||||
|
|
||||||
| @router.http("DELETE", 'graph/vertices/"{vertex_id}"') | ||||||
| @router.http("DELETE", 'graph/vertices/{vertex_id}') | ||||||
| def removeVertexById(self, vertex_id): # pylint: disable=unused-argument | ||||||
| return self._invoke_request() | ||||||
|
|
||||||
|
|
@@ -200,8 +200,10 @@ def getVerticesById(self, vertex_ids) -> list[VertexData] | None: | |||||
| if not vertex_ids: | ||||||
| return [] | ||||||
| path = "traversers/vertices?" | ||||||
| for vertex_id in vertex_ids: | ||||||
| path += f'ids="{vertex_id}"&' # pylint: disable=consider-using-join | ||||||
| quoted_vertex_ids = map(json.dumps, vertex_ids) | ||||||
|
|
||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| for vertex_id in quoted_vertex_ids: | ||||||
| path += f'ids={vertex_id}&' # pylint: disable=consider-using-join | ||||||
| path = path.rstrip("&") | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
def test_get_vertices_by_number_id(self):
vertex = self.graph.addVertex("department", {"name": "DeptA", "headcount": 10, "floor": 1})
result = self.graph.getVerticesById([vertex.id])
self.assertIsNotNone(result)
self.assertEqual(result[0].id, vertex.id) |
||||||
| if response := self._sess.request(path): | ||||||
| return [VertexData(item) for item in response["vertices"]] | ||||||
|
|
||||||
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.
🧹 Removing the trailing comma after
"rich"is unrelated to this bug fix and adds diff noise. TOML allows trailing commas; the original style is consistent with the rest of the list. Please revert this hunk.