MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / get_constraint

Function get_constraint

tests/flow/constraint_utils.py:39–57  ·  view source on GitHub ↗
(g, ct_type, entity_type, lbl, *props)

Source from the content-addressed store, hash-verified

37 return self.ct
38
39def get_constraint(g, ct_type, entity_type, lbl, *props):
40 props_filter = "properties = [" + ",".join(["'" + p + "'" for p in props]) + "]"
41
42 q = f"""CALL db.constraints() YIELD type, label, properties, entitytype, status
43 WHERE type = '{ct_type}' AND label = '{lbl}' AND {props_filter}
44 RETURN type, label, properties, entitytype, status"""
45
46 result = g.query(q, read_only=True).result_set
47 c = None
48 if len(result) == 1:
49 row = result[0]
50 ct = row[0]
51 lbl = row[1]
52 attrs = row[2]
53 et = row[3]
54 status = row[4]
55 c = Constraint(ct, et, lbl, attrs, status)
56
57 return c
58
59def wait_on_constraint(g, ct_type, entity_type, lbl, *props):
60 props_filter = "properties = [" + ",".join(["'" + p + "'" for p in props]) + "]"

Callers 1

test_CRUD_replicationMethod · 0.85

Calls 2

ConstraintClass · 0.85
queryMethod · 0.45

Tested by 1

test_CRUD_replicationMethod · 0.68