and is accompanied by tooltip showing ""2.3MB"". ( #1712 )
The base Docker image used by datasette publish cloudrun , datasette package and the official Datasette image has been upgraded to 3.10.6-slim-bullseye . ( #1768 )
Canned writable queries against immutable databases now show a warning message. ( #1728 )
datasette publish cloudrun has a new --timeout option which can be used to increase the time limit applied by the Google Cloud build environment. Thanks, Tim Sherratt. ( #1717 )
datasette publish cloudrun has new --min-instances and --max-instances options. ( #1779 )","[""Changelog"", ""0.62 (2022-08-14)""]","[{""href"": ""https://pyodide.org/"", ""label"": ""Pyodide""}, {""href"": ""https://lite.datasette.io/"", ""label"": ""Datasette Lite""}, {""href"": ""https://github.com/simonw/datasette/issues/1733"", ""label"": ""#1733""}, {""href"": ""https://github.com/simonw/datasette/issues/1739"", ""label"": ""#1739""}, {""href"": ""https://github.com/simonw/datasette/pull/1759"", ""label"": ""#1759""}, {""href"": ""https://github.com/simonw/datasette/issues/1727"", ""label"": ""this research issue""}, {""href"": ""https://github.com/simonw/datasette/issues/1744"", ""label"": ""#1744""}, {""href"": ""https://github.com/simonw/datasette/issues/1701"", ""label"": ""#1701""}, {""href"": ""https://github.com/simonw/datasette/issues/1712"", ""label"": ""#1712""}, {""href"": ""https://hub.docker.com/datasetteproject/datasette"", ""label"": ""official Datasette image""}, {""href"": ""https://github.com/simonw/datasette/issues/1768"", ""label"": ""#1768""}, {""href"": ""https://github.com/simonw/datasette/issues/1728"", ""label"": ""#1728""}, {""href"": ""https://github.com/simonw/datasette/pull/1717"", ""label"": ""#1717""}, {""href"": ""https://github.com/simonw/datasette/issues/1779"", ""label"": ""#1779""}]"
changelog:id178,changelog,id178,0.14 (2017-12-09),"The theme of this release is customization: Datasette now allows every aspect
of its presentation to be customized
either using additional CSS or by providing entirely new templates.
Datasette's metadata.json format
has also been expanded, to allow per-database and per-table metadata. A new
datasette skeleton command can be used to generate a skeleton JSON file
ready to be filled in with per-database and per-table details.
The metadata.json file can also be used to define
canned queries ,
as a more powerful alternative to SQL views.
extra_css_urls / extra_js_urls in metadata
A mechanism in the metadata.json format for adding custom CSS and JS urls.
Create a metadata.json file that looks like this:
{
""extra_css_urls"": [
""https://simonwillison.net/static/css/all.bf8cd891642c.css""
],
""extra_js_urls"": [
""https://code.jquery.com/jquery-3.2.1.slim.min.js""
]
}
Then start datasette like this:
datasette mydb.db --metadata=metadata.json
The CSS and JavaScript files will be linked in the of every page.
You can also specify a SRI (subresource integrity hash) for these assets:
{
""extra_css_urls"": [
{
""url"": ""https://simonwillison.net/static/css/all.bf8cd891642c.css"",
""sri"": ""sha384-9qIZekWUyjCyDIf2YK1FRoKiPJq4PHt6tp/ulnuuyRBvazd0hG7pWbE99zvwSznI""
}
],
""extra_js_urls"": [
{
""url"": ""https://code.jquery.com/jquery-3.2.1.slim.min.js"",
""sri"": ""sha256-k2WSCIexGzOj3Euiig+TlR8gA0EmPjuc79OEeY5L45g=""
}
]
}
Modern browsers will only execute the stylesheet or JavaScript if the SRI hash
matches the content served. You can generate hashes using https://www.srihash.org/
Auto-link column values that look like URLs ( #153 )
CSS styling hooks as classes on the body ( #153 )
Every template now gets CSS classes in the body designed to support custom
styling.
The index template (the top level page at / ) gets this:
The database template ( /dbname/ ) gets this:
The table template ( /dbname/tablename ) gets:
The row template ( /dbname/tablename/rowid ) gets:
The db-x and table-x classes use the database or table names themselves IF
they are valid CSS identifiers. If they aren't, we strip any invalid
characters out and append a 6 character md5 digest of the original name, in
order to ensure that multiple tables which resolve to the same stripped
character version still have different CSS classes.
Some examples (extracted from the unit tests):
""simple"" => ""simple""
""MixedCase"" => ""MixedCase""
""-no-leading-hyphens"" => ""no-leading-hyphens-65bea6""
""_no-leading-underscores"" => ""no-leading-underscores-b921bc""
""no spaces"" => ""no-spaces-7088d7""
""-"" => ""336d5e""
""no $ characters"" => ""no--characters-59e024""
datasette --template-dir=mytemplates/ argument
You can now pass an additional argument specifying a directory to look for
custom templates in.
Datasette will fall back on the default templates if a template is not
found in that directory.
Ability to over-ride templates for individual tables/databases.
It is now possible to over-ride templates on a per-database / per-row or per-
table basis.
When you access e.g. /mydatabase/mytable Datasette will look for the following:
- table-mydatabase-mytable.html
- table.html
If you provided a --template-dir argument to datasette serve it will look in
that directory first.
The lookup rules are as follows:
Index page (/):
index.html
Database page (/mydatabase):
database-mydatabase.html
database.html
Table page (/mydatabase/mytable):
table-mydatabase-mytable.html
table.html
Row page (/mydatabase/mytable/id):
row-mydatabase-mytable.html
row.html
If a table name has spaces or other unexpected characters in it, the template
filename will follow the same rules as our custom CSS classes
- for example, a table called ""Food Trucks""
will attempt to load the following templates:
table-mydatabase-Food-Trucks-399138.html
table.html
It is possible to extend the default templates using Jinja template
inheritance. If you want to customize EVERY row template with some additional
content you can do so by creating a row.html template like this:
{% extends ""default:row.html"" %}
{% block content %}
EXTRA HTML AT THE TOP OF THE CONTENT BLOCK
This line renders the original block:
{{ super() }}
{% endblock %}
--static option for datasette serve ( #160 )
You can now tell Datasette to serve static files from a specific location at a
specific mountpoint.
For example:
datasette serve mydb.db --static extra-css:/tmp/static/css
Now if you visit this URL:
http://localhost:8001/extra-css/blah.css
The following file will be served:
/tmp/static/css/blah.css
Canned query support.
Named canned queries can now be defined in metadata.json like this:
{
""databases"": {
""timezones"": {
""queries"": {
""timezone_for_point"": ""select tzid from timezones ...""
}
}
}
}
These will be shown in a new ""Queries"" section beneath ""Views"" on the database page.
New datasette skeleton command for generating metadata.json ( #164 )
metadata.json support for per-table/per-database metadata ( #165 )
Also added support for descriptions and HTML descriptions.
Here's an example metadata.json file illustrating custom per-database and per-
table metadata:
{
""title"": ""Overall datasette title"",
""description_html"": ""This is a description with HTML."",
""databases"": {
""db1"": {
""title"": ""First database"",
""description"": ""This is a string description & has no HTML"",
""license_url"": ""http://example.com/"",
""license"": ""The example license"",
""queries"": {
""canned_query"": ""select * from table1 limit 3;""
},
""tables"": {
""table1"": {
""title"": ""Custom title for table1"",
""description"": ""Tables can have descriptions too"",
""source"": ""This has a custom source"",
""source_url"": ""http://example.com/""
}
}
}
}
}
Renamed datasette build command to datasette inspect ( #130 )
Upgrade to Sanic 0.7.0 ( #168 )
https://github.com/channelcat/sanic/releases/tag/0.7.0
Package and publish commands now accept --static and --template-dir
Example usage:
datasette package --static css:extra-css/ --static js:extra-js/ \
sf-trees.db --template-dir templates/ --tag sf-trees --branch master
This creates a local Docker image that includes copies of the templates/,
extra-css/ and extra-js/ directories. You can then run it like this:
docker run -p 8001:8001 sf-trees
For publishing to Zeit now:
datasette publish now --static css:extra-css/ --static js:extra-js/ \
sf-trees.db --template-dir templates/ --name sf-trees --branch master
HTML comment showing which templates were considered for a page ( #171 )","[""Changelog""]","[{""href"": ""https://docs.datasette.io/en/stable/custom_templates.html"", ""label"": ""to be customized""}, {""href"": ""https://docs.datasette.io/en/stable/metadata.html"", ""label"": ""metadata.json format""}, {""href"": ""https://docs.datasette.io/en/stable/sql_queries.html#canned-queries"", ""label"": ""canned queries""}, {""href"": ""https://www.srihash.org/"", ""label"": ""https://www.srihash.org/""}, {""href"": ""https://github.com/simonw/datasette/issues/153"", ""label"": ""#153""}, {""href"": ""https://github.com/simonw/datasette/issues/153"", ""label"": ""#153""}, {""href"": ""https://github.com/simonw/datasette/issues/160"", ""label"": ""#160""}, {""href"": ""https://github.com/simonw/datasette/issues/164"", ""label"": ""#164""}, {""href"": ""https://github.com/simonw/datasette/issues/165"", ""label"": ""#165""}, {""href"": ""https://github.com/simonw/datasette/issues/130"", ""label"": ""#130""}, {""href"": ""https://github.com/simonw/datasette/issues/168"", ""label"": ""#168""}, {""href"": ""https://github.com/channelcat/sanic/releases/tag/0.7.0"", ""label"": ""https://github.com/channelcat/sanic/releases/tag/0.7.0""}, {""href"": ""https://github.com/simonw/datasette/issues/171"", ""label"": ""#171""}]"
changelog:id17,changelog,id17,0.62 (2022-08-14),"Datasette can now run entirely in your browser using WebAssembly. Try out Datasette Lite , take a look at the code or read more about it in Datasette Lite: a server-side Python web application running in a browser .
Datasette now has a Discord community for questions and discussions about Datasette and its ecosystem of projects.","[""Changelog""]","[{""href"": ""https://lite.datasette.io/"", ""label"": ""Datasette Lite""}, {""href"": ""https://github.com/simonw/datasette-lite"", ""label"": ""at the code""}, {""href"": ""https://simonwillison.net/2022/May/4/datasette-lite/"", ""label"": ""Datasette Lite: a server-side Python web application running in a browser""}, {""href"": ""https://datasette.io/discord"", ""label"": ""Discord community""}]"
changelog:id165,changelog,id165,0.15 (2018-04-09),"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.
table_rows => table_rows_count , filtered_table_rows =>
filtered_table_rows_count
Renamed properties. Closes #194
New sortable_columns option in metadata.json to control sort options.
You can now explicitly set which columns in a table can be used for sorting
using the _sort and _sort_desc arguments using metadata.json :
{
""databases"": {
""database1"": {
""tables"": {
""example_table"": {
""sortable_columns"": [
""height"",
""weight""
]
}
}
}
}
}
Refs #189
Column headers now link to sort/desc sort - refs #189
_sort and _sort_desc parameters for table views
Allows for paginated sorted results based on a specified column.
Refs #189
Total row count now correct even if _next applied
Use .custom_sql() for _group_count implementation (refs #150 )
Make HTML title more readable in query template ( #180 ) [Ryan Pitts]
New ?_shape=objects/object/lists param for JSON API ( #192 )
New _shape= parameter replacing old .jsono extension
Now instead of this:
/database/table.jsono
We use the _shape parameter like this:
/database/table.json?_shape=objects
Also introduced a new _shape called object which looks like this:
/database/table.json?_shape=object
Returning 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.db
This is useful for making a SQLite database of the test fixtures for
interactive exploration.
Compound primary key _next= now plays well with extra filters
Closes #190
Fixed bug with keyset pagination over compound primary keys
Refs #190
Database/Table views inherit source/license/source_url/license_url
metadata
If you set the source_url/license_url/source/license fields in your root
metadata those values will now be inherited all the way down to the database
and table templates.
The title/description are 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 geojson and it caused an exception because the regex
was matching .json and not \.json
Deploy to Heroku with Python 3.6.3","[""Changelog""]","[{""href"": ""https://github.com/simonw/datasette/issues/194"", ""label"": ""#194""}, {""href"": ""https://github.com/simonw/datasette/issues/189"", ""label"": ""#189""}, {""href"": ""https://github.com/simonw/datasette/issues/189"", ""label"": ""#189""}, {""href"": ""https://github.com/simonw/datasette/issues/189"", ""label"": ""#189""}, {""href"": ""https://github.com/simonw/datasette/issues/150"", ""label"": ""#150""}, {""href"": ""https://github.com/simonw/datasette/issues/180"", ""label"": ""#180""}, {""href"": ""https://github.com/simonw/datasette/issues/192"", ""label"": ""#192""}, {""href"": ""https://github.com/simonw/datasette/issues/122"", ""label"": ""#122""}, {""href"": ""https://github.com/simonw/datasette/issues/190"", ""label"": ""#190""}, {""href"": ""https://github.com/simonw/datasette/issues/190"", ""label"": ""#190""}, {""href"": ""https://github.com/simonw/datasette/issues/185"", ""label"": ""#185""}, {""href"": ""https://github.com/simonw/datasette/issues/178"", ""label"": ""#178""}]"
changelog:id16,changelog,id16,Documentation,"New tutorial: Cleaning data with sqlite-utils and Datasette .
Screenshots in the documentation are now maintained using shot-scraper , as described in Automating screenshots for the Datasette documentation using shot-scraper . ( #1844 )
More detailed command descriptions on the CLI reference page. ( #1787 )
New documentation on Running Datasette using OpenRC - thanks, Adam Simpson. ( #1825 )","[""Changelog"", ""0.63 (2022-10-27)""]","[{""href"": ""https://datasette.io/tutorials/clean-data"", ""label"": ""Cleaning data with sqlite-utils and Datasette""}, {""href"": ""https://shot-scraper.datasette.io/"", ""label"": ""shot-scraper""}, {""href"": ""https://simonwillison.net/2022/Oct/14/automating-screenshots/"", ""label"": ""Automating screenshots for the Datasette documentation using shot-scraper""}, {""href"": ""https://github.com/simonw/datasette/issues/1844"", ""label"": ""#1844""}, {""href"": ""https://github.com/simonw/datasette/issues/1787"", ""label"": ""#1787""}, {""href"": ""https://github.com/simonw/datasette/pull/1825"", ""label"": ""#1825""}]"
changelog:id159,changelog,id159,0.16 (2018-04-13),"Better mechanism for handling errors; 404s for missing table/database
New error mechanism closes #193
404s for missing tables/databases closes #184
long_description in markdown for the new PyPI
Hide SpatiaLite system tables. [Russ Garrett]
Allow explain select / explain query plan select #201
Datasette inspect now finds primary_keys #195
Ability to sort using form fields (for mobile portrait mode) #199
We now display sort options as a select box plus a descending checkbox, which
means you can apply sort orders even in portrait mode on a mobile phone where
the column headers are hidden.","[""Changelog""]","[{""href"": ""https://github.com/simonw/datasette/issues/193"", ""label"": ""#193""}, {""href"": ""https://github.com/simonw/datasette/issues/184"", ""label"": ""#184""}, {""href"": ""https://github.com/simonw/datasette/issues/201"", ""label"": ""#201""}, {""href"": ""https://github.com/simonw/datasette/issues/195"", ""label"": ""#195""}, {""href"": ""https://github.com/simonw/datasette/issues/199"", ""label"": ""#199""}]"
changelog:id158,changelog,id158,0.17 (2018-04-13),Release 0.17 to fix issues with PyPI,"[""Changelog""]",[]
changelog:id156,changelog,id156,0.18 (2018-04-14),"This release introduces support for units ,
contributed by Russ Garrett ( #203 ).
You can now optionally specify the units for specific columns using metadata.json .
Once specified, units will be displayed in the HTML view of your table. They also become
available for use in filters - if a column is configured with a unit of distance, you can
request all rows where that column is less than 50 meters or more than 20 feet for example.
Link foreign keys which don't have labels. [Russ Garrett]
This renders unlabeled FKs as simple links.
Also includes bonus fixes for two minor issues:
In foreign key link hrefs the primary key was escaped using HTML
escaping rather than URL escaping. This broke some non-integer PKs.
Print tracebacks to console when handling 500 errors.
Fix SQLite error when loading rows with no incoming FKs. [Russ
Garrett]
This fixes an error caused by an invalid query when loading incoming FKs.
The error was ignored due to async but it still got printed to the
console.
Allow custom units to be registered with Pint. [Russ Garrett]
Support units in filters. [Russ Garrett]
Tidy up units support. [Russ Garrett]
Add units to exported JSON
Units key in metadata skeleton
Docs
Initial units support. [Russ Garrett]
Add support for specifying units for a column in metadata.json and
rendering them on display using
pint","[""Changelog""]","[{""href"": ""https://docs.datasette.io/en/stable/metadata.html#specifying-units-for-a-column"", ""label"": ""support for units""}, {""href"": ""https://github.com/simonw/datasette/issues/203"", ""label"": ""#203""}, {""href"": ""https://pint.readthedocs.io/en/latest/"", ""label"": ""pint""}]"
changelog:id15,changelog,id15,0.63 (2022-10-27),See Datasette 0.63: The annotated release notes for more background on the changes in this release.,"[""Changelog""]","[{""href"": ""https://simonwillison.net/2022/Oct/27/datasette-0-63/"", ""label"": ""Datasette 0.63: The annotated release notes""}]"
changelog:id149,changelog,id149,0.19 (2018-04-16),"This is the first preview of the new Datasette plugins mechanism. Only two
plugin hooks are available so far - for custom SQL functions and custom template
filters. There's plenty more to come - read the documentation and get involved in
the tracking ticket if you
have feedback on the direction so far.
Fix for _sort_desc=sortable_with_nulls test, refs #216
Fixed #216 - paginate correctly when sorting by nullable column
Initial documentation for plugins, closes #213
https://docs.datasette.io/en/stable/plugins.html
New --plugins-dir=plugins/ option ( #212 )
New option causing Datasette to load and evaluate all of the Python files in
the specified directory and register any plugins that are defined in those
files.
This new option is available for the following commands:
datasette serve mydb.db --plugins-dir=plugins/
datasette publish now/heroku mydb.db --plugins-dir=plugins/
datasette package mydb.db --plugins-dir=plugins/
Start of the plugin system, based on pluggy ( #210 )
Uses https://pluggy.readthedocs.io/ originally created for the py.test project
We're starting with two plugin hooks:
prepare_connection(conn)
This is called when a new SQLite connection is created. It can be used to register custom SQL functions.
prepare_jinja2_environment(env)
This is called with the Jinja2 environment. It can be used to register custom template tags and filters.
An example plugin which uses these two hooks can be found at https://github.com/simonw/datasette-plugin-demos or installed using pip install datasette-plugin-demos
Refs #14
Return HTTP 405 on InvalidUsage rather than 500. [Russ Garrett]
This also stops it filling up the logs. This happens for HEAD requests
at the moment - which perhaps should be handled better, but that's a
different issue.","[""Changelog""]","[{""href"": ""https://docs.datasette.io/en/stable/plugins.html"", ""label"": ""the documentation""}, {""href"": ""https://github.com/simonw/datasette/issues/14"", ""label"": ""the tracking ticket""}, {""href"": ""https://github.com/simonw/datasette/issues/216"", ""label"": ""#216""}, {""href"": ""https://github.com/simonw/datasette/issues/216"", ""label"": ""#216""}, {""href"": ""https://github.com/simonw/datasette/issues/213"", ""label"": ""#213""}, {""href"": ""https://docs.datasette.io/en/stable/plugins.html"", ""label"": ""https://docs.datasette.io/en/stable/plugins.html""}, {""href"": ""https://github.com/simonw/datasette/issues/212"", ""label"": ""#212""}, {""href"": ""https://github.com/simonw/datasette/issues/14"", ""label"": ""#210""}, {""href"": ""https://pluggy.readthedocs.io/"", ""label"": ""https://pluggy.readthedocs.io/""}, {""href"": ""https://github.com/simonw/datasette-plugin-demos"", ""label"": ""https://github.com/simonw/datasette-plugin-demos""}, {""href"": ""https://github.com/simonw/datasette/issues/14"", ""label"": ""#14""}]"
changelog:id140,changelog,id140,0.20 (2018-04-20),"Mostly new work on the Plugins mechanism: plugins can now bundle static assets and custom templates, and datasette publish has a new --install=name-of-plugin option.
Add col-X classes to HTML table on custom query page
Fixed out-dated template in documentation
Plugins can now bundle custom templates, #224
Added /-/metadata /-/plugins /-/inspect, #225
Documentation for --install option, refs #223
Datasette publish/package --install option, #223
Fix for plugins in Python 3.5, #222
New plugin hooks: extra_css_urls() and extra_js_urls(), #214
/-/static-plugins/PLUGIN_NAME/ now serves static/ from plugins
now gets class=""col-X"" - plus added col-X documentation
Use to_css_class for table cell column classes
This ensures that columns with spaces in the name will still
generate usable CSS class names. Refs #209
Add column name classes to | s, make PK bold [Russ Garrett]
Don't duplicate simple primary keys in the link column [Russ Garrett]
When there's a simple (single-column) primary key, it looks weird to
duplicate it in the link column.
This change removes the second PK column and treats the link column as
if it were the PK column from a header/sorting perspective.
Correct escaping for HTML display of row links [Russ Garrett]
Longer time limit for test_paginate_compound_keys
It was failing intermittently in Travis - see #209
Use application/octet-stream for downloadable databases
Updated PyPI classifiers
Updated PyPI link to pypi.org","[""Changelog""]","[{""href"": ""https://github.com/simonw/datasette/issues/224"", ""label"": ""#224""}, {""href"": ""https://github.com/simonw/datasette/issues/225"", ""label"": ""#225""}, {""href"": ""https://github.com/simonw/datasette/issues/223"", ""label"": ""#223""}, {""href"": ""https://github.com/simonw/datasette/issues/223"", ""label"": ""#223""}, {""href"": ""https://github.com/simonw/datasette/issues/222"", ""label"": ""#222""}, {""href"": ""https://github.com/simonw/datasette/issues/214"", ""label"": ""#214""}, {""href"": ""https://github.com/simonw/datasette/issues/209"", ""label"": ""#209""}, {""href"": ""https://github.com/simonw/datasette/issues/209"", ""label"": ""#209""}]"
changelog:id14,changelog,id14,0.63.1 (2022-11-10),"Fixed a bug where Datasette's table filter form would not redirect correctly when run behind a proxy using the base_url setting. ( #1883 )
SQL query is now shown wrapped in a |