From 59cae7d207d93da3d8efa7533edb2b4b8a543504 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 15 Mar 2020 09:25:10 -0500 Subject: [PATCH] Only show tables for "public" schema i.e. avoid the "batch" schema --- tailbone/views/tables.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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)