Moves the sql generation out of the check module so that the client is responsible for doing what it needs to to 'heal' the graph.