Extract the creation of TsdbQuery objects into a QueryBuilder