for tag, count in baseq.join(Tag.packs).group_by(Tag.id).all():
        tags[tag]['packs'] = count