Datasette 0.15: sort by column
The biggest new feature in this release is the ability to sort by column. On the table page the column headers can now be clicked to apply sort (or descending sort), or you can specify ?_sort=column or ?_sort_desc=column directly in the URL.
You can try this feature out on this fivethirtyeight data about the ages of different US politicians.
-
table_rows=>table_rows_count,filtered_table_rows=>filtered_table_rows_countRenamed properties. Closes #194
-
New
sortable_columnsoption inmetadata.jsonto control sort options.You can now explicitly set which columns in a table can be used for sorting using the
_sortand_sort_descarguments usingmetadata.json:{ "databases": { "database1": { "tables": { "example_table": { "sortable_columns": [ "height", "weight" ] } } } } }Refs #189
-
Column headers now link to sort/desc sort - refs #189
-
_sortand_sort_descparameters for table viewsAllows for paginated sorted results based on a specified column.
Refs #189
-
Total row count now correct even if
_nextapplied -
Use .custom_sql() for _group_count implementation (refs #150)
-
Make HTML title more readable in query template (#180) [Ryan Pitts]
-
New
?_shape=objects/object/listsparam for JSON API (#192)New
_shape=parameter replacing old.jsonoextensionNow instead of this:
/database/table.jsonoWe use the
_shapeparameter like this:/database/table.json?_shape=objectsAlso introduced a new
_shapecalledobjectwhich looks like this:/database/table.json?_shape=objectReturning an object for the rows key:
... "rows": { "pk1": { ... }, "pk2": { ... } }Refs #122
-
Utility for writing test database fixtures to a .db file
python tests/fixtures.py /tmp/hello.dbThis is useful for making a SQLite database of the test fixtures for interactive exploration.
-
Compound primary key
_next=now plays well with extra filtersCloses #190
-
Fixed bug with keyset pagination over compound primary keys
Refs #190
-
Database/Table views inherit
source/license/source_url/license_urlmetadataIf you set the
source_url/license_url/source/licensefields in your root metadata those values will now be inherited all the way down to the database and table templates.The
title/descriptionare NOT inherited.Also added unit tests for the HTML generated by the metadata.
Refs #185
-
Add metadata, if it exists, to heroku temp dir (#178) [Tony Hirst]
-
Initial documentation for pagination
-
Broke up test_app into test_api and test_html
-
Fixed bug with .json path regular expression
I had a table called
geojsonand it caused an exception because the regex was matching.jsonand not\.json -
Deploy to Heroku with Python 3.6.3