namedtuples() Similarly, you can return the rows from the cursor as dictionaries using dicts(): stats = (Stat .select(Stat.url, fn.Count(Stat.url).alias('ct'))# iterate over a list of 2-tuples containing the url and count