Added build_query method to generator template