Updated multi table query generator to read from config