diff --git a/tailbone/views/tables.py b/tailbone/views/tables.py index fc6ee6a9..78363f66 100644 --- a/tailbone/views/tables.py +++ b/tailbone/views/tables.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2019 Lance Edgar +# Copyright © 2010-2020 Lance Edgar # # This file is part of Rattail. # @@ -52,13 +52,18 @@ class TablesView(MasterView): """ Fetch existing table names and estimate row counts via PG SQL """ + # note that we only show 'public' schema tables, i.e. avoid the 'batch' + # schema, at least for now? maybe should include all, plus show the + # schema name within the results grid? sql = """ - select schemaname, relname, n_live_tup + select relname, n_live_tup from pg_stat_user_tables + where schemaname = 'public' order by n_live_tup desc; """ result = self.Session.execute(sql) - return [dict(name=row[1], row_count=row[2]) for row in result] + return [dict(name=row['relname'], row_count=row['n_live_tup']) + for row in result] def configure_grid(self, g): g.sorters['name'] = g.make_simple_sorter('name', foldcase=True)