// Sort (name, code, value) list by variable name
sorted_cats = sorted(cursor, key=operator.itemgetter(0))
// Group triples by variable name -> list? of (name, group)
groups = itertools.groupby(sorted_cats, key=operator.itemgetter(0))
return {"column-statistical-types": stattypes,
"categories": {name: {triple[1]:triple[2] for triple in group} for name, group in groups},
"models": []}
def _unique_rowid(self, rowids):