Skip to content

Commit ab1ea64

Browse files
committed
docs(langchain): explain why refresh_schema uses no LIMIT on DISTINCT query
1 parent 6d009a7 commit ab1ea64

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

  • langchain-coordinode/langchain_coordinode

langchain-coordinode/langchain_coordinode/graph.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ def refresh_schema(self) -> None:
7272
structured = _parse_schema(text)
7373
# Augment with relationship triples (start_label, type, end_label) via
7474
# Cypher — get_schema_text() only lists edge types without direction.
75+
# No LIMIT here intentionally: RETURN DISTINCT already collapses all edges
76+
# to unique (src_label, rel_type, dst_label) combinations, so the result
77+
# is bounded by the number of distinct relationship type triples, not by
78+
# total edge count. Adding a LIMIT would silently drop relationship types
79+
# that happen to appear beyond the limit, producing an incomplete schema.
7580
rows = self._client.cypher(
7681
"MATCH (a)-[r]->(b) RETURN DISTINCT labels(a) AS src_labels, type(r) AS rel, labels(b) AS dst_labels"
7782
)

0 commit comments

Comments
 (0)