Fix neo4j type error on missing constraint information (#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
This commit is contained in:
Tomaz Bratanic 2024-07-12 12:39:29 +02:00 committed by GitHub
parent 7014d07cab
commit d3a2b9fae0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -555,10 +555,11 @@ class Neo4jGraph(GraphStore):
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(