From eef213ab4d57622dfc60c8655c0c7a18afcc844f Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Tue, 24 Oct 2017 17:11:36 -0700 Subject: [PATCH] Show total number of rows in table --- app.py | 3 +++ templates/table.html | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 0eb2dd98..7ceb780d 100644 --- a/app.py +++ b/app.py @@ -195,10 +195,13 @@ class TableView(BaseView): columns = [r[0] for r in rows.description] pks = pks_for_table(conn, table) rows = list(rows) + info = ensure_build_metadata() + total_rows = info[name]['tables'][table] return { 'database': name, 'table': table, 'rows': rows, + 'total_rows': total_rows, 'columns': columns, 'primary_keys': pks, }, lambda: { diff --git a/templates/table.html b/templates/table.html index fda692f7..8183f8af 100644 --- a/templates/table.html +++ b/templates/table.html @@ -5,7 +5,7 @@ {% block content %}

{{ database }}

-

{{ table }}

+

{{ table }} ({{ total_rows }} total row{% if total_rows == 1 %}{% else %}s{% endif %} in this table)