Skip to content

Commit 9a12f87

Browse files
author
Matt Sokoloff
committed
style
1 parent 871139a commit 9a12f87

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

labelbox/orm/query.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,15 @@ def results_query_part(entity):
4040
Args:
4141
entity (type): The entity which needs fetching.
4242
"""
43+
# Query for fields
4344
fields = [field.graphql_name for field in entity.fields()]
44-
for relationship in entity.relationships():
45-
if relationship.cache:
46-
fields.append(
47-
Query(relationship.graphql_name,
48-
relationship.destination_type).format()[0])
45+
46+
# Query for cached relationships
47+
fields.extend([
48+
Query(rel.graphql_name, rel.destination_type).format()[0]
49+
for rel in entity.relationships()
50+
if rel.cache
51+
])
4952
return " ".join(fields)
5053

5154

0 commit comments

Comments
 (0)