kopia lustrzana https://github.com/simonw/datasette
Don't try to show row counts for views
Also handle tables/views with spaces in their name in the URL.pull/383/head
rodzic
bd5f3b2ba1
commit
2fe94641b0
3
app.py
3
app.py
|
|
@ -183,6 +183,7 @@ class TableView(BaseView):
|
||||||
|
|
||||||
def data(self, request, name, hash, table):
|
def data(self, request, name, hash, table):
|
||||||
conn = get_conn(name)
|
conn = get_conn(name)
|
||||||
|
table = urllib.parse.unquote_plus(table)
|
||||||
if request.args:
|
if request.args:
|
||||||
where_clause, params = build_where_clause(request.args)
|
where_clause, params = build_where_clause(request.args)
|
||||||
sql = 'select * from "{}" where {} limit 50'.format(
|
sql = 'select * from "{}" where {} limit 50'.format(
|
||||||
|
|
@ -196,7 +197,7 @@ class TableView(BaseView):
|
||||||
pks = pks_for_table(conn, table)
|
pks = pks_for_table(conn, table)
|
||||||
rows = list(rows)
|
rows = list(rows)
|
||||||
info = ensure_build_metadata()
|
info = ensure_build_metadata()
|
||||||
total_rows = info[name]['tables'][table]
|
total_rows = info[name]['tables'].get(table)
|
||||||
return {
|
return {
|
||||||
'database': name,
|
'database': name,
|
||||||
'table': table,
|
'table': table,
|
||||||
|
|
|
||||||
Ładowanie…
Reference in New Issue