import ibis ibis.options.interactive = True conn = ibis.mysql.connect(user='root', password='mysql', database='db') tables = conn.list_tables() t = conn.tables('some_table') t.group_by(['genre']).aggregate(count=t.count()).sort_by([ibis.desc('count')]).limit(10) genre count 0 NaN 9429 1 1.0 2543 2 8.0 1557 3 2.0 1435 4 18.0 1401 5 3.0 1396 6 15.0 1227 7 13.0 1157 8 21.0 1106 9 5.0 1017