def add_reverse_edge_type(client: GraphClient, uid_type: UidType, edge_name: str) -> None: LOGGER.debug( f"adding reverse edge type uid_type: {uid_type} edge_name: {edge_name}" ) self_type = uid_type._inner_type.self_type() existing_predicates = query_dgraph_type(client, self_type) predicates = "\n\t\t".join(existing_predicates) # In case we've already deployed this plugin if edge_name in predicates: return predicates += f"\n\t\t<~{edge_name}>" type_str = f""" type {self_type} {{ {predicates} }}\n """ op = pydgraph.Operation(schema=type_str) client.alter(op)
def set_schema(client: GraphClient, schema: str) -> None: op = pydgraph.Operation(schema=schema) client.alter(op)
def set_schema(client: GraphClient, schema: str) -> None: op = pydgraph.Operation(schema=schema, run_in_background=True) LOGGER.info(f"Setting dgraph schema: {schema}") client.alter(op, timeout=SecsDuration(5)) LOGGER.info(f"Completed setting dgraph schema")