Skip to content

Commit

Permalink
Fixed double query execution
Browse files Browse the repository at this point in the history
  • Loading branch information
tonioo committed Nov 4, 2024
1 parent 7a36673 commit 1d927bc
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
3 changes: 1 addition & 2 deletions neomodel/async_/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -1499,10 +1499,9 @@ async def resolve_subgraph(self) -> list:
raise RuntimeError(
"Nothing to resolve. Make sure to include relations in the result using fetch_relations() or filter()."
)
all_nodes = qbuilder._execute(dict_output=True)
other_nodes = {}
root_node = None
async for row in all_nodes:
async for row in qbuilder._execute(dict_output=True):
for name, node in row.items():
if node.__class__ is self.source and "_" not in name:
root_node = node
Expand Down
3 changes: 1 addition & 2 deletions neomodel/sync_/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -1499,10 +1499,9 @@ def resolve_subgraph(self) -> list:
raise RuntimeError(
"Nothing to resolve. Make sure to include relations in the result using fetch_relations() or filter()."
)
all_nodes = qbuilder._execute(dict_output=True)
other_nodes = {}
root_node = None
for row in all_nodes:
for row in qbuilder._execute(dict_output=True):
for name, node in row.items():
if node.__class__ is self.source and "_" not in name:
root_node = node
Expand Down
4 changes: 1 addition & 3 deletions test/async_/test_match_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1048,12 +1048,10 @@ async def test_mix_functions():
"parents",
)
.fetch_relations(
"lives_in",
Optional("children__has_latest_course"),
)
.subquery(
filtered_nodeset.order_by("name")
.fetch_relations("has_course")
Student.nodes.fetch_relations("has_course")
.intermediate_transform(
{"rel": RelationNameResolver("has_course")},
ordering=[
Expand Down
4 changes: 1 addition & 3 deletions test/sync_/test_match_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1034,12 +1034,10 @@ def test_mix_functions():
"parents",
)
.fetch_relations(
"lives_in",
Optional("children__has_latest_course"),
)
.subquery(
filtered_nodeset.order_by("name")
.fetch_relations("has_course")
Student.nodes.fetch_relations("has_course")
.intermediate_transform(
{"rel": RelationNameResolver("has_course")},
ordering=[
Expand Down

0 comments on commit 1d927bc

Please sign in to comment.