html_url,id,node_id,tag_name,target_commitish,name,draft,author,author_label,prerelease,created_at,published_at,body,repo,repo_label,reactions https://github.com/simonw/datasette/releases/tag/0.57a0,43419091,MDc6UmVsZWFzZTQzNDE5MDkx,0.57a0,main,0.57a0,0,9599,simonw,1,2021-05-23T00:45:54Z,2021-05-23T00:46:44Z,"Mainly dependency bumps, plus a new `?_facet_size=` argument. - Updated dependencies: pytest-asyncio, Black, jinja2, aiofiles, itsdangerous - Fixed bug where columns called ""Link"" were incorrectly displayed in bold. ([#1308](https://github.com/simonw/datasette/issues/1308)) - New `?_facet_size=` argument for customizing the number of facet results returned on a page. ([#1332](https://github.com/simonw/datasette/issues/1332))",107914493,datasette, https://github.com/simonw/datasette/releases/tag/0.23.2,11825600,MDc6UmVsZWFzZTExODI1NjAw,0.23.2,main,Datasette 0.23.2,0,9599,simonw,0,2018-07-08T05:28:45Z,2018-07-08T05:41:38Z,"Minor bugfix and documentation release. * CSV export now respects `--cors`, fixes #326 * [Installation instructions](https://datasette.readthedocs.io/en/latest/installation.html) including docker image - closes #328 * Fix for row pages for tables with / in, closes #325",107914493,datasette, https://github.com/simonw/datasette/releases/tag/0.23.1,11591352,MDc6UmVsZWFzZTExNTkxMzUy,0.23.1,main,Datasette 0.23.1,0,9599,simonw,0,2018-06-21T15:37:13Z,2018-06-21T16:02:44Z,"Minor bugfix release. * Correctly display empty strings in HTML table, closes #314 * Allow “.” in database filenames, closes #302 * 404s ending in slash redirect to remove that slash, closes #309 * Fixed incorrect display of compound primary keys with foreign key references. Closes #319 * Docs + example of canned SQL query using || concatenation. Closes #321 * Correctly display facets with value of 0 - closes #318 * Default ‘expand labels’ to checked in CSV advanced export ",107914493,datasette, https://github.com/simonw/datasette/releases/tag/0.20,10645022,MDc6UmVsZWFzZTEwNjQ1MDIy,0.20,main,Datasette 0.20: static assets and templates for plugins,0,9599,simonw,0,2018-04-20T14:36:29Z,2018-04-20T14:41:14Z,"Mostly new work on the [Plugins](http://datasette.readthedocs.io/en/latest/plugins.html) 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 databses - Updated PyPI classifiers - Updated PyPI link to pypi.org",107914493,datasette, https://github.com/simonw/datasette/releases/tag/0.21,10868113,MDc6UmVsZWFzZTEwODY4MTEz,0.21,main,"Datasette 0.21: New _shape=, new _size=, search within columns",0,9599,simonw,0,2018-05-05T23:15:38Z,2018-05-05T23:21:33Z,"New JSON `_shape=` options, the ability to set table `_size=` and a mechanism for searching within specific columns. - Default tests to using a longer timelimit Every now and then a test will fail in Travis CI on Python 3.5 because it hit the default 20ms SQL time limit. Test fixtures now default to a 200ms time limit, and we only use the 20ms time limit for the specific test that tests query interruption. This should make our tests on Python 3.5 in Travis much more stable. - Support `_search_COLUMN=text` searches, closes [\#237](https://github.com/simonw/datasette/issues/237) - Show version on `/-/plugins` page, closes [\#248](https://github.com/simonw/datasette/issues/248) - `?_size=max` option, closes [\#249](https://github.com/simonw/datasette/issues/249) - Added `/-/versions` and `/-/versions.json`, closes [\#244](https://github.com/simonw/datasette/issues/244) Sample output: { ""python"": { ""version"": ""3.6.3"", ""full"": ""3.6.3 (default, Oct 4 2017, 06:09:38) \n[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)]"" }, ""datasette"": { ""version"": ""0.20"" }, ""sqlite"": { ""version"": ""3.23.1"", ""extensions"": { ""json1"": null, ""spatialite"": ""4.3.0a"" } } } - Renamed `?_sql_time_limit_ms=` to `?_timelimit`, closes [\#242](https://github.com/simonw/datasette/issues/242) - New `?_shape=array` option + tweaks to `_shape`, closes [\#245](https://github.com/simonw/datasette/issues/245) - Default is now `?_shape=arrays` (renamed from `lists`) - New `?_shape=array` returns an array of objects as the root object - Changed `?_shape=object` to return the object as the root - Updated docs - FTS tables now detected by `inspect()`, closes [\#240](https://github.com/simonw/datasette/issues/240) - New `?_size=XXX` querystring parameter for table view, closes [\#229](https://github.com/simonw/datasette/issues/229) Also added documentation for all of the `_special` arguments. Plus deleted some duplicate logic implementing `_group_count`. - If `max_returned_rows==page_size`, increment `max_returned_rows` - fixes [\#230](https://github.com/simonw/datasette/issues/230) - New `hidden: True` option for table metadata, closes [\#239](https://github.com/simonw/datasette/issues/239) - Hide `idx_*` tables if spatialite detected, closes [\#228](https://github.com/simonw/datasette/issues/228) - Added `class=rows-and-columns` to custom query results table - Added CSS class `rows-and-columns` to main table - `label_column` option in `metadata.json` - closes [\#234](https://github.com/simonw/datasette/issues/234)",107914493,datasette, https://github.com/simonw/datasette/releases/tag/0.25,12986637,MDc6UmVsZWFzZTEyOTg2NjM3,0.25,master,Datasette 0.25,0,9599,simonw,0,2018-09-19T17:48:12Z,2018-09-19T18:27:21Z,"New plugin hooks, improved database view support and an easier way to use more recent versions of SQLite. See full release notes here: https://datasette.readthedocs.io/en/latest/changelog.html#v0-25",107914493,datasette, https://github.com/simonw/datasette/releases/tag/0.26.1,15206659,MDc6UmVsZWFzZTE1MjA2NjU5,0.26.1,master,Datasette 0.26.1,0,9599,simonw,0,2019-01-11T00:51:38Z,2019-01-28T01:50:45Z,Release notes: https://datasette.readthedocs.io/en/stable/changelog.html#v0-26-1,107914493,datasette, https://github.com/simonw/datasette/releases/tag/0.63,81262417,RE_kwDOBm6k_c4E1_dR,0.63,main,0.63,0,9599,simonw,0,2022-10-27T22:11:26Z,2022-10-27T22:13:32Z,"See [Datasette 0.63: The annotated release notes](https://simonwillison.net/2022/Oct/27/datasette-0-63/) for more background on the changes in this release. ## Features - Now tested against Python 3.11. Docker containers used by `datasette publish` and `datasette package` both now use that version of Python. ([#1853](https://github.com/simonw/datasette/issues/1853)) - `--load-extension` option now supports entrypoints. Thanks, Alex Garcia. ([#1789](https://github.com/simonw/datasette/pull/1789)) - Facet size can now be set per-table with the new `facet_size` table metadata option. ([#1804](https://github.com/simonw/datasette/issues/1804)) - The [truncate_cells_html](https://docs.datasette.io/en/stable/settings.html#setting-truncate-cells-html) setting now also affects long URLs in columns. ([#1805](https://github.com/simonw/datasette/issues/1805)) - The non-JavaScript SQL editor textarea now increases height to fit the SQL query. ([#1786](https://github.com/simonw/datasette/issues/1786)) - Facets are now displayed with better line-breaks in long values. Thanks, Daniel Rech. ([#1794](https://github.com/simonw/datasette/pull/1794)) - The `settings.json` file used in [Configuration directory mode](https://docs.datasette.io/en/stable/settings.html#config-dir) is now validated on startup. ([#1816](https://github.com/simonw/datasette/issues/1816)) - SQL queries can now include leading SQL comments, using `/* ... */` or `-- ...` syntax. Thanks, Charles Nepote. ([#1860](https://github.com/simonw/datasette/issues/1860)) - SQL query is now re-displayed when terminated with a time limit error. ([#1819](https://github.com/simonw/datasette/issues/1819)) - The [inspect data](https://docs.datasette.io/en/stable/performance.html#performance-inspect) mechanism is now used to speed up server startup - thanks, Forest Gregg. ([#1834](https://github.com/simonw/datasette/issues/1834)) - In [Configuration directory mode](https://docs.datasette.io/en/stable/settings.html#config-dir) databases with filenames ending in `.sqlite` or `.sqlite3` are now automatically added to the Datasette instance. ([#1646](https://github.com/simonw/datasette/issues/1646)) - Breadcrumb navigation display now respects the current user's permissions. ([#1831](https://github.com/simonw/datasette/issues/1831)) ## Plugin hooks and internals - The [prepare_jinja2_environment(env, datasette)](https://docs.datasette.io/en/stable/plugin_hooks.html#plugin-hook-prepare-jinja2-environment) plugin hook now accepts an optional `datasette` argument. Hook implementations can also now return an `async` function which will be awaited automatically. ([#1809](https://github.com/simonw/datasette/issues/1809)) - `Database(is_mutable=)` now defaults to `True`. ([#1808](https://github.com/simonw/datasette/issues/1808)) - The [datasette.check_visibility()](https://docs.datasette.io/en/stable/internals.html#datasette-check-visibility) method now accepts an optional `permissions=` list, allowing it to take multiple permissions into account at once when deciding if something should be shown as public or private. This has been used to correctly display padlock icons in more places in the Datasette interface. ([#1829](https://github.com/simonw/datasette/issues/1829)) - Datasette no longer enforces upper bounds on its dependencies. ([#1800](https://github.com/simonw/datasette/issues/1800)) ## Documentation - New tutorial: [Cleaning data with sqlite-utils and Datasette](https://datasette.io/tutorials/clean-data). - Screenshots in the documentation are now maintained using [shot-scraper](https://shot-scraper.datasette.io/), as described in [Automating screenshots for the Datasette documentation using shot-scraper](https://simonwillison.net/2022/Oct/14/automating-screenshots/). ([#1844](https://github.com/simonw/datasette/issues/1844)) - More detailed command descriptions on the [CLI reference](https://docs.datasette.io/en/stable/cli-reference.html#cli-reference) page. ([#1787](https://github.com/simonw/datasette/issues/1787)) - New documentation on [Running Datasette using OpenRC](https://docs.datasette.io/en/stable/deploying.html#deploying-openrc) - thanks, Adam Simpson. ([#1825](https://github.com/simonw/datasette/pull/1825))",107914493,datasette,"{""url"": ""https://api.github.com/repos/simonw/datasette/releases/81262417/reactions"", ""total_count"": 1, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 1, ""rocket"": 0, ""eyes"": 0}" https://github.com/simonw/datasette/releases/tag/0.24,12080036,MDc6UmVsZWFzZTEyMDgwMDM2,0.24,main,Datasette 0.24,0,9599,simonw,0,2018-07-24T04:34:38Z,2018-07-24T16:51:29Z,"See full release notes here: http://datasette.readthedocs.io/en/latest/changelog.html#v0-24 ",107914493,datasette, https://github.com/simonw/datasette/releases/tag/0.55,38264801,MDc6UmVsZWFzZTM4MjY0ODAx,0.55,main,0.55,0,9599,simonw,0,2021-02-19T02:01:06Z,2021-02-19T02:02:29Z,"Support for cross-database SQL queries and built-in support for serving via HTTPS. - The new `--crossdb` command-line option causes Datasette to attach up to ten database files to the same `/_memory` database connection. This enables cross-database SQL queries, including the ability to use joins and unions to combine data from tables that exist in different database files. See [Cross-database queries](https://docs.datasette.io/en/stable/sql_queries.html#cross-database-queries) for details. ([#283](https://github.com/simonw/datasette/issues/283)) - `--ssl-keyfile` and `--ssl-certfile` options can be used to specify a TLS certificate, allowing Datasette to serve traffic over `https://` without needing to run it behind a separate proxy. ([#1221](https://github.com/simonw/datasette/issues/1221)) - The `/:memory:` page has been renamed (and redirected) to `/_memory` for consistency with the new `/_internal` database introduced in Datasette 0.54. ([#1205](https://github.com/simonw/datasette/issues/1205)) - Added plugin testing documentation on [Using pdb for errors thrown inside Datasette](https://docs.datasette.io/en/stable//testing_plugins.html#testing-plugins-pdb). ([#1207](https://github.com/simonw/datasette/issues/1207)) - The [official Datasette Docker image](https://hub.docker.com/r/datasetteproject/datasette) now uses Python 3.7.10, applying [the latest security fix](https://www.python.org/downloads/release/python-3710/) for that Python version. ([#1235](https://github.com/simonw/datasette/issues/1235))",107914493,datasette, https://github.com/simonw/datasette/releases/tag/0.22,11087850,MDc6UmVsZWFzZTExMDg3ODUw,0.22,main,Datasette 0.22: Datasette Facets,0,9599,simonw,0,2018-05-20T23:41:47Z,2018-05-20T23:44:19Z,"The big new feature in this release is [facets](http://datasette.readthedocs.io/en/latest/facets.html). Datasette can now apply faceted browse to any column in any table. It will also suggest possible facets. See the [Datasette Facets](https://simonwillison.net/2018/May/20/datasette-facets/) announcement post for more details. In addition to the work on facets: - Added [docs for introspection endpoints](https://datasette.readthedocs.io/en/latest/introspection.html) - New `--config` option, added `--help-config`, closes #274 Removed the `--page_size=` argument to `datasette serve` in favour of: datasette serve --config default_page_size:50 mydb.db Added new help section: $ datasette --help-config Config options: default_page_size Default page size for the table view (default=100) max_returned_rows Maximum rows that can be returned from a table or custom query (default=1000) sql_time_limit_ms Time limit for a SQL query in milliseconds (default=1000) default_facet_size Number of values to return for requested facets (default=30) facet_time_limit_ms Time limit for calculating a requested facet (default=200) facet_suggest_time_limit_ms Time limit for calculating a suggested facet (default=50) - Only apply responsive table styles to `.rows-and-column` Otherwise they interfere with tables in the description, e.g. on https://fivethirtyeight.datasettes.com/fivethirtyeight/nba-elo%2Fnbaallelo - Refactored views into new `views/` modules, refs #256 - [Documentation for SQLite full-text search](http://datasette.readthedocs.io/en/latest/full_text_search.html) support, closes #253 - `/-/versions` now includes SQLite `fts_versions`, closes #252",107914493,datasette, https://github.com/simonw/datasette/releases/tag/0.15,10458641,MDc6UmVsZWFzZTEwNDU4NjQx,0.15,main,Datasette 0.15: sort by column,0,9599,simonw,0,2018-04-09T15:48:24Z,2018-04-09T15:55:29Z,"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](https://fivethirtyeight.datasettes.com/fivethirtyeight/congress-age%2Fcongress-terms) about the ages of different US politicians. - `table_rows` =\> `table_rows_count`, `filtered_table_rows` =\> `filtered_table_rows_count` Renamed properties. Closes [\#194](https://github.com/simonw/datasette/issues/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](https://github.com/simonw/datasette/issues/189) - Column headers now link to sort/desc sort - refs [\#189](https://github.com/simonw/datasette/issues/189) - `_sort` and `_sort_desc` parameters for table views Allows for paginated sorted results based on a specified column. Refs [\#189](https://github.com/simonw/datasette/issues/189) - Total row count now correct even if `_next` applied - Use .custom\_sql() for \_group\_count implementation (refs [\#150](https://github.com/simonw/datasette/issues/150)) - Make HTML title more readable in query template ([\#180](https://github.com/simonw/datasette/issues/180)) \[Ryan Pitts\] - New `?_shape=objects/object/lists` param for JSON API ([\#192](https://github.com/simonw/datasette/issues/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](https://github.com/simonw/datasette/issues/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](https://github.com/simonw/datasette/issues/190) - Fixed bug with keyset pagination over compound primary keys Refs [\#190](https://github.com/simonw/datasette/issues/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](https://github.com/simonw/datasette/issues/185) - Add metadata, if it exists, to heroku temp dir ([\#178](https://github.com/simonw/datasette/issues/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",107914493,datasette, https://github.com/simonw/datasette/releases/tag/0.50,32384200,MDc6UmVsZWFzZTMyMzg0MjAw,0.50,main,0.50,0,9599,simonw,0,2020-10-09T17:57:55Z,2020-10-09T17:58:27Z,"The key new feature in this release is the **column actions** menu on the table page ([#891](https://github.com/simonw/datasette/issues/891)). This can be used to sort a column in ascending or descending order, facet data by that column or filter the table to just rows that have a value for that column. Plugin authors can use the new [datasette.client](https://docs.datasette.io/en/stable/internals.html#internals-datasette-client) object to make internal HTTP requests from their plugins, allowing them to make use of Datasette's JSON API. ([#943](https://github.com/simonw/datasette/issues/943)) New [Deploying Datasette](https://docs.datasette.io/en/stable/deploying.html#deploying) documentation with guides for deploying Datasette on a Linux server [using systemd](https://docs.datasette.io/en/stable/deploying.html#deploying-systemd) or to hosting providers [that support buildpacks](https://docs.datasette.io/en/stable/deploying.html#deploying-buildpacks). ([#514](https://github.com/simonw/datasette/issues/514), [#997](https://github.com/simonw/datasette/issues/997)) Other improvements in this release: - [Publishing to Google Cloud Run](https://docs.datasette.io/en/stable/publish.html#publish-cloud-run) documentation now covers Google Cloud SDK options. Thanks, Geoffrey Hing. ([#995](https://github.com/simonw/datasette/pull/995)) - New `datasette -o` option which opens your browser as soon as Datasette starts up. ([#970](https://github.com/simonw/datasette/issues/970)) - Datasette now sets `sqlite3.enable_callback_tracebacks(True)` so that errors in custom SQL functions will display tracebacks. ([#891](https://github.com/simonw/datasette/issues/891)) - Fixed two rendering bugs with column headers in portrait mobile view. ([#978](https://github.com/simonw/datasette/issues/978), [#980](https://github.com/simonw/datasette/issues/980)) - New `db.table_column_details(table)` introspection method for retrieving full details of the columns in a specific table, see [Database introspection](https://docs.datasette.io/en/stable/internals.html#internals-database-introspection). - Fixed a routing bug with custom page wildcard templates. ([#996](https://github.com/simonw/datasette/issues/996)) - `datasette publish heroku` now deploys using Python 3.8.6. - New `datasette publish heroku --tar=` option. ([#969](https://github.com/simonw/datasette/issues/969)) - `OPTIONS` requests against HTML pages no longer return a 500 error. ([#1001](https://github.com/simonw/datasette/issues/1001)) - Datasette now supports Python 3.9.",107914493,datasette, https://github.com/simonw/datasette/releases/tag/0.43,26994005,MDc6UmVsZWFzZTI2OTk0MDA1,0.43,master,0.43,0,9599,simonw,0,2020-05-28T14:11:06Z,2020-05-28T14:39:18Z,"The main focus of this release is a major upgrade to the [register_output_renderer(datasette)](https://datasette.readthedocs.io/en/stable/plugins.html#plugin-register-output-renderer) plugin hook, which allows plugins to provide new output formats for Datasette such as [datasette-atom](https://github.com/simonw/datasette-atom) and [datasette-ics](https://github.com/simonw/datasette-ics). - Redesign of [register_output_renderer(datasette)](https://datasette.readthedocs.io/en/stable/plugins.html#plugin-register-output-renderer) to provide more context to the render callback and support an optional `""can_render""` callback that controls if a suggested link to the output format is provided. ([#581](https://github.com/simonw/datasette/issues/581), [#770](https://github.com/simonw/datasette/issues/770)) - Visually distinguish float and integer columns - useful for figuring out why order-by-column might be returning unexpected results. ([#729](https://github.com/simonw/datasette/issues/729)) - The [Request object](https://datasette.readthedocs.io/en/stable/internals.html#internals-request), which is passed to several plugin hooks, is now documented. ([#706](https://github.com/simonw/datasette/issues/706)) - New `metadata.json` option for setting a custom default page size for specific tables and views, see [Setting a custom page size](https://datasette.readthedocs.io/en/stable/metadata.html#metadata-page-size). ([#751](https://github.com/simonw/datasette/issues/751)) - Canned queries can now be configured with a default URL fragment hash, useful when working with plugins such as [datasette-vega](https://github.com/simonw/datasette-vega), see [Setting a default fragment](https://datasette.readthedocs.io/en/stable/sql_queries.html#canned-queries-default-fragment). ([#706](https://github.com/simonw/datasette/issues/706)) - Fixed a bug in `datasette publish` when running on operating systems where the `/tmp` directory lives in a different volume, using a backport of the Python 3.8 `shutil.copytree()` function. ([#744](https://github.com/simonw/datasette/issues/744)) - Every plugin hook is now covered by the unit tests, and a new unit test checks that each plugin hook has at least one corresponding test. ([#771](https://github.com/simonw/datasette/issues/771), [#773](https://github.com/simonw/datasette/issues/773))",107914493,datasette, https://github.com/simonw/datasette/releases/tag/0.14,8841695,MDc6UmVsZWFzZTg4NDE2OTU=,0.14,main,Datasette 0.14: customization edition,0,9599,simonw,0,2017-12-10T01:33:24Z,2017-12-10T01:41:14Z,"The theme of this release is customization: Datasette now allows every aspect of its presentation [to be customized](http://datasette.readthedocs.io/en/latest/custom_templates.html) either using additional CSS or by providing entirely new templates. Datasette's [metadata.json format](http://datasette.readthedocs.io/en/latest/metadata.html) 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](http://datasette.readthedocs.io/en/latest/sql_queries.html#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 - Auto-link column values that look like URLs ([\#153](https://github.com/simonw/datasette/issues/153)) - CSS styling hooks as classes on the body ([\#153](https://github.com/simonw/datasette/issues/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](https://github.com/simonw/datasette/issues/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](https://github.com/simonw/datasette/issues/164)) - `metadata.json` support for per-table/per-database metadata ([\#165](https://github.com/simonw/datasette/issues/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](https://github.com/simonw/datasette/issues/130)) - Upgrade to Sanic 0.7.0 ([\#168](https://github.com/simonw/datasette/issues/168)) - 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](https://github.com/simonw/datasette/issues/171)) ",107914493,datasette, https://github.com/simonw/datasette/releases/tag/1.0a2,86103928,RE_kwDOBm6k_c4FIdd4,1.0a2,main,1.0a2,0,9599,simonw,1,2022-12-15T02:02:42Z,2022-12-15T02:03:59Z,"The third Datasette 1.0 alpha release adds upsert support to the JSON API, plus the ability to specify finely grained permissions when creating an API token. See [Datasette 1.0a2: Upserts and finely grained permissions](https://simonwillison.net/2022/Dec/15/datasette-1a2/) for an extended, annotated version of these release notes. - New `/db/table/-/upsert` API, [documented here](https://docs.datasette.io/en/latest/json_api.html#tableupsertview). upsert is an update-or-insert: existing rows will have specified keys updated, but if no row matches the incoming primary key a brand new row will be inserted instead. ([#1878](https://github.com/simonw/datasette/issues/1878)) - New [register_permissions(datasette)](https://docs.datasette.io/en/latest/plugin_hooks.html#plugin-register-permissions) plugin hook. Plugins can now register named permissions, which will then be listed in various interfaces that show available permissions. ([#1940](https://github.com/simonw/datasette/issues/1940)) - The `/db/-/create` API for [creating a table](https://docs.datasette.io/en/latest/json_api.html#tablecreateview) now accepts `""ignore"": true` and `""replace"": true` options when called with the `""rows""` property that creates a new table based on an example set of rows. This means the API can be called multiple times with different rows, setting rules for what should happen if a primary key collides with an existing row. ([#1927](https://github.com/simonw/datasette/issues/1927)) - Arbitrary permissions can now be configured at the instance, database and resource (table, SQL view or canned query) level in Datasette's [Metadata](https://docs.datasette.io/en/latest/metadata.html#metadata) JSON and YAML files. The new `""permissions""` key can be used to specify which actors should have which permissions. See [Other permissions in metadata](https://docs.datasette.io/en/latest/authentication.html#authentication-permissions-other) for details. ([#1636](https://github.com/simonw/datasette/issues/1636)) - The `/-/create-token` page can now be used to create API tokens which are restricted to just a subset of actions, including against specific databases or resources. See [API Tokens](https://docs.datasette.io/en/latest/authentication.html#createtokenview) for details. ([#1947](https://github.com/simonw/datasette/issues/1947)) - Likewise, the [datasette create-token](https://docs.datasette.io/en/latest/internals.html#create-token-actor-id-expires-after-none-restrict-all-none-restrict-database-none-restrict-resource-none) CLI command can now create tokens with [a subset of permissions](https://docs.datasette.io/en/latest/authentication.html#authentication-cli-create-token-restrict). ([#1855](https://github.com/simonw/datasette/issues/1855)) - New datasette.create_token() API method ` for programmatically creating signed API tokens. ([#1951](https://github.com/simonw/datasette/issues/1951)) - `/db/-/create` API now requires actor to have `insert-row` permission in order to use the `""row""` or `""rows""` properties. ([#1937](https://github.com/simonw/datasette/issues/1937))",107914493,datasette, https://github.com/simonw/datasette/releases/tag/0.54,36871901,MDc6UmVsZWFzZTM2ODcxOTAx,0.54,main,0.54,0,9599,simonw,0,2021-01-25T17:35:06Z,2021-01-25T17:36:30Z,"The two big new features in this release are the `_internal` SQLite in-memory database storing details of all connected databases and tables, and support for JavaScript modules in plugins and additional scripts. For additional commentary on this release, see [Datasette 0.54, the annotated release notes](https://simonwillison.net/2021/Jan/25/datasette/). ### The _internal database As part of ongoing work to help Datasette handle much larger numbers of connected databases and tables (see [Datasette Library](https://github.com/simonw/datasette/issues/417)) Datasette now maintains an in-memory SQLite database with details of all of the attached databases, tables, columns, indexes and foreign keys. ([#1150](https://github.com/simonw/datasette/issues/1150)) This will support future improvements such as a searchable, paginated homepage of all available tables. You can explore an example of this database by [signing in as root](https://latest.datasette.io/login-as-root) to the `latest.datasette.io` demo instance and then navigating to [latest.datasette.io/_internal](https://latest.datasette.io/_internal). Plugins can use these tables to introspect attached data in an efficient way. Plugin authors should note that this is not yet considered a stable interface, so any plugins that use this may need to make changes prior to Datasette 1.0 if the `_internal` table schemas change. ### Named in-memory database support As part of the work building the `_internal` database, Datasette now supports named in-memory databases that can be shared across multiple connections. This allows plugins to create in-memory databases which will persist data for the lifetime of the Datasette server process. ([#1151](https://github.com/simonw/datasette/issues/1151)) The new `memory_name=` parameter to the [Database class](https://docs.datasette.io/en/stable/internals.html#internals-database) can be used to create named, shared in-memory databases. ### JavaScript modules [JavaScript modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) were introduced in ECMAScript 2015 and provide native browser support for the `import` and `export` keywords. To use modules, JavaScript needs to be included in `