mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Removed _group_count=col feature, closes #504
This commit is contained in:
parent
e5dc89a58b
commit
bccf474abd
2 changed files with 0 additions and 21 deletions
|
|
@ -499,18 +499,6 @@ class TableView(RowTableShared):
|
||||||
if order_by:
|
if order_by:
|
||||||
order_by = "order by {} ".format(order_by)
|
order_by = "order by {} ".format(order_by)
|
||||||
|
|
||||||
# _group_count=col1&_group_count=col2
|
|
||||||
group_count = special_args_lists.get("_group_count") or []
|
|
||||||
if group_count:
|
|
||||||
sql = 'select {group_cols}, count(*) as "count" from {table_name} {where} group by {group_cols} order by "count" desc limit 100'.format(
|
|
||||||
group_cols=", ".join(
|
|
||||||
'"{}"'.format(group_count_col) for group_count_col in group_count
|
|
||||||
),
|
|
||||||
table_name=escape_sqlite(table),
|
|
||||||
where=where_clause,
|
|
||||||
)
|
|
||||||
return await self.custom_sql(request, database, hash, sql, editable=True)
|
|
||||||
|
|
||||||
extra_args = {}
|
extra_args = {}
|
||||||
# Handle ?_size=500
|
# Handle ?_size=500
|
||||||
page_size = _size or request.raw_args.get("_size")
|
page_size = _size or request.raw_args.get("_size")
|
||||||
|
|
|
||||||
|
|
@ -321,15 +321,6 @@ Special table arguments
|
||||||
|
|
||||||
Here's `an example <https://latest.datasette.io/fixtures/roadside_attractions?_through={%22table%22:%22roadside_attraction_characteristics%22,%22column%22:%22characteristic_id%22,%22value%22:%221%22}>`__.
|
Here's `an example <https://latest.datasette.io/fixtures/roadside_attractions?_through={%22table%22:%22roadside_attraction_characteristics%22,%22column%22:%22characteristic_id%22,%22value%22:%221%22}>`__.
|
||||||
|
|
||||||
|
|
||||||
``?_group_count=COLUMN``
|
|
||||||
Executes a SQL query that returns a count of the number of rows matching
|
|
||||||
each unique value in that column, with the most common ordered first.
|
|
||||||
|
|
||||||
``?_group_count=COLUMN1&_group_count=column2``
|
|
||||||
You can pass multiple ``_group_count`` columns to return counts against
|
|
||||||
unique combinations of those columns.
|
|
||||||
|
|
||||||
``?_next=TOKEN``
|
``?_next=TOKEN``
|
||||||
Pagination by continuation token - pass the token that was returned in the
|
Pagination by continuation token - pass the token that was returned in the
|
||||||
``"next"`` property by the previous page.
|
``"next"`` property by the previous page.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue