Skip to content

Commit 392d665

Browse files
committed
templates/table.html: use ['count'] for the count-all click handler
Warehouse overrides datasette's table.html via --template-dir, so the upstream fix on duckdb-deploy doesn't reach the rendered page — the warehouse copy still had data['rows'][0]['count(*)'] which is wrong on DuckDB (returns null since the column is named 'count_star()'). Match the upstream fix here. (The SQLite track is unaffected because SQLite returns 'count(*)' as the column name; the upstream change aliases to 'count' which is what this JS now reads.)
1 parent 6d3ab79 commit 392d665

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

templates/table.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,10 @@ <h3>Download this data</h3>
211211
console.log('throw error');
212212
throw new Error(data.title || data.error);
213213
}
214-
const count = data['rows'][0]['count(*)'];
214+
// SQL aliases the column to `count` (datasette views/table.py)
215+
// so this works on any backend — SQLite would otherwise return
216+
// key "count(*)", DuckDB "count_star()".
217+
const count = data['rows'][0]['count'];
215218
const formattedCount = count.toLocaleString();
216219
span.closest('h3').textContent = formattedCount + ' rows';
217220
} catch (error) {

0 commit comments

Comments
 (0)