| 37 | return self.ct |
| 38 | |
| 39 | def 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 | |
| 59 | def wait_on_constraint(g, ct_type, entity_type, lbl, *props): |
| 60 | props_filter = "properties = [" + ",".join(["'" + p + "'" for p in props]) + "]" |