Skip to content

Commit

Permalink
Fix neo4j type error on missing constraint information (langchain-ai#…
Browse files Browse the repository at this point in the history
…24177)

If you use `refresh_schema=False`, then the metadata constraint doesn't
exist. ATM, we used default `None` in the constraint check, but then
`any` fails because it can't iterate over None value
  • Loading branch information
tomasonjo authored Jul 12, 2024
1 parent 7014d07 commit d3a2b9f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libs/community/langchain_community/graphs/neo4j_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,10 +555,11 @@ def add_graph_documents(
el["labelsOrTypes"] == [BASE_ENTITY_LABEL]
and el["properties"] == ["id"]
for el in self.structured_schema.get("metadata", {}).get(
"constraint"
"constraint", []
)
]
)

if not constraint_exists:
# Create constraint
self.query(
Expand Down

0 comments on commit d3a2b9f

Please sign in to comment.