kopia lustrzana https://github.com/simonw/datasette
Show total number of rows in table
rodzic
1ae8ea0f03
commit
eef213ab4d
3
app.py
3
app.py
|
@ -195,10 +195,13 @@ class TableView(BaseView):
|
||||||
columns = [r[0] for r in rows.description]
|
columns = [r[0] for r in rows.description]
|
||||||
pks = pks_for_table(conn, table)
|
pks = pks_for_table(conn, table)
|
||||||
rows = list(rows)
|
rows = list(rows)
|
||||||
|
info = ensure_build_metadata()
|
||||||
|
total_rows = info[name]['tables'][table]
|
||||||
return {
|
return {
|
||||||
'database': name,
|
'database': name,
|
||||||
'table': table,
|
'table': table,
|
||||||
'rows': rows,
|
'rows': rows,
|
||||||
|
'total_rows': total_rows,
|
||||||
'columns': columns,
|
'columns': columns,
|
||||||
'primary_keys': pks,
|
'primary_keys': pks,
|
||||||
}, lambda: {
|
}, lambda: {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1><a href="/{{ database }}-{{ database_hash }}">{{ database }}</a></h1>
|
<h1><a href="/{{ database }}-{{ database_hash }}">{{ database }}</a></h1>
|
||||||
|
|
||||||
<h2>{{ table }}</h2>
|
<h2>{{ table }} ({{ total_rows }} total row{% if total_rows == 1 %}{% else %}s{% endif %} in this table)</h2>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
td {
|
td {
|
||||||
|
|
Ładowanie…
Reference in New Issue