commented grid query generator