.. _changelog:
=========
Changelog
=========
.. _v0_48:
0.48 (2020-08-16)
-----------------
- Datasette documentation now lives at `docs.datasette.io `__.
- ``db.is_mutable`` property is now documented and tested, see :ref:`internals_database_introspection`.
- The ``extra_template_vars``, ``extra_css_urls``, ``extra_js_urls`` and ``extra_body_script`` plugin hooks now all accept the same arguments. See :ref:`plugin_hook_extra_template_vars` for details. (`#939 `__)
- Those hooks now accept a new ``columns`` argument detailing the table columns that will be rendered on that page. (`#938 `__)
- Fixed bug where plugins calling ``db.execute_write_fn()`` could hang Datasette if the connection failed. (`#935 `__)
- Fixed bug with the ``?_nl=on`` output option and binary data. (`#914 `__)
.. _v0_47_3:
0.47.3 (2020-08-15)
-------------------
- The ``datasette --get`` command-line mechanism now ensures any plugins using the ``startup()`` hook are correctly executed. (`#934 `__)
.. _v0_47_2:
0.47.2 (2020-08-12)
-------------------
- Fixed an issue with the Docker image `published to Docker Hub `__. (`#931 `__)
.. _v0_47_1:
0.47.1 (2020-08-11)
-------------------
- Fixed a bug where the ``sdist`` distribution of Datasette was not correctly including the template files. (`#930 `__)
.. _v0_47:
0.47 (2020-08-11)
-----------------
- Datasette now has `a GitHub discussions forum `__ for conversations about the project that go beyond just bug reports and issues.
- Datasette can now be installed on macOS using Homebrew! Run ``brew install simonw/datasette/datasette``. See :ref:`installation_homebrew`. (`#335 `__)
- Two new commands: ``datasette install name-of-plugin`` and ``datasette uninstall name-of-plugin``. These are equivalent to ``pip install`` and ``pip uninstall`` but automatically run in the same virtual environment as Datasette, so users don't have to figure out where that virtual environment is - useful for installations created using Homebrew or ``pipx``. See :ref:`plugins_installing`. (`#925 `__)
- A new command-line option, ``datasette --get``, accepts a path to a URL within the Datasette instance. It will run that request through Datasette (without starting a web server) and print out the repsonse. See :ref:`getting_started_datasette_get` for an example. (`#926 `__)
.. _v0_46:
0.46 (2020-08-09)
-----------------
.. warning::
This release contains a security fix related to authenticated writable canned queries. If you are using this feature you should upgrade as soon as possible.
- **Security fix:** CSRF tokens were incorrectly included in read-only canned query forms, which could allow them to be leaked to a sophisticated attacker. See `issue 918 `__ for details.
- Datasette now supports GraphQL via the new `datasette-graphql `__ plugin - see `GraphQL in Datasette with the new datasette-graphql plugin `__.
- Principle git branch has been renamed from ``master`` to ``main``. (`#849 `__)
- New debugging tool: ``/-/allow-debug tool`` (`demo here `__) helps test allow blocks against actors, as described in :ref:`authentication_permissions_allow`. (`#908 `__)
- New logo for the documentation, and a new project tagline: "An open source multi-tool for exploring and publishing data".
- Whitespace in column values is now respected on display, using ``white-space: pre-wrap``. (`#896 `__)
- New ``await request.post_body()`` method for accessing the raw POST body, see :ref:`internals_request`. (`#897 `__)
- Database file downloads now include a ``content-length`` HTTP header, enabling download progress bars. (`#905 `__)
- File downloads now also correctly set the suggested file name using a ``content-disposition`` HTTP header. (`#909 `__)
- ``tests`` are now excluded from the Datasette package properly - thanks, abeyerpath. (`#456 `__)
- The Datasette package published to PyPI now includes ``sdist`` as well as ``bdist_wheel``.
- Better titles for canned query pages. (`#887 `__)
- Now only loads Python files from a directory passed using the ``--plugins-dir`` option - thanks, Amjith Ramanujam. (`#890 `__)
- New documentation section on :ref:`publish_vercel`.
.. _v0_45:
0.45 (2020-07-01)
-----------------
Magic parameters for canned queries, a log out feature, improved plugin documentation and four new plugin hooks.
Magic parameters for canned queries
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Canned queries now support :ref:`canned_queries_magic_parameters`, which can be used to insert or select automatically generated values. For example::
insert into logs
(user_id, timestamp)
values
(:_actor_id, :_now_datetime_utc)
This inserts the currently authenticated actor ID and the current datetime. (`#842 `__)
Log out
~~~~~~~
The :ref:`ds_actor cookie ` can be used by plugins (or by Datasette's :ref:`--root mechanism`) to authenticate users. The new ``/-/logout`` page provides a way to clear that cookie.
A "Log out" button now shows in the global navigation provided the user is authenticated using the ``ds_actor`` cookie. (`#840 `__)
Better plugin documentation
~~~~~~~~~~~~~~~~~~~~~~~~~~~
The plugin documentation has been re-arranged into four sections, including a brand new section on testing plugins. (`#687 `__)
- :ref:`plugins` introduces Datasette's plugin system and describes how to install and configure plugins.
- :ref:`writing_plugins` describes how to author plugins, from simple one-off plugins to packaged plugins that can be published to PyPI. It also describes how to start a plugin using the new `datasette-plugin `__ cookiecutter template.
- :ref:`plugin_hooks` is a full list of detailed documentation for every Datasette plugin hook.
- :ref:`testing_plugins` describes how to write tests for Datasette plugins, using `pytest `__ and `HTTPX `__.
New plugin hooks
~~~~~~~~~~~~~~~~
- :ref:`plugin_hook_register_magic_parameters` can be used to define new types of magic canned query parameters.
- :ref:`plugin_hook_startup` can run custom code when Datasette first starts up. `datasette-init `__ is a new plugin that uses this hook to create database tables and views on startup if they have not yet been created. (`#834 `__)
- :ref:`plugin_hook_canned_queries` lets plugins provide additional canned queries beyond those defined in Datasette's metadata. See `datasette-saved-queries `__ for an example of this hook in action. (`#852 `__)
- :ref:`plugin_hook_forbidden` is a hook for customizing how Datasette responds to 403 forbidden errors. (`#812 `__)
Smaller changes
~~~~~~~~~~~~~~~
- Cascading view permissons - so if a user has ``view-table`` they can view the table page even if they do not have ``view-database`` or ``view-instance``. (`#832 `__)
- CSRF protection no longer applies to ``Authentication: Bearer token`` requests or requests without cookies. (`#835 `__)
- ``datasette.add_message()`` now works inside plugins. (`#864 `__)
- Workaround for "Too many open files" error in test runs. (`#846 `__)
- Respect existing ``scope["actor"]`` if already set by ASGI middleware. (`#854 `__)
- New process for shipping :ref:`contributing_alpha_beta`. (`#807 `__)
- ``{{ csrftoken() }}`` now works when plugins render a template using ``datasette.render_template(..., request=request)``. (`#863 `__)
- Datasette now creates a single :ref:`internals_request` and uses it throughout the lifetime of the current HTTP request. (`#870 `__)
.. _v0_44:
0.44 (2020-06-11)
-----------------
Authentication and permissions, writable canned queries, flash messages, new plugin hooks and more.
Authentication
~~~~~~~~~~~~~~
Prior to this release the Datasette ecosystem has treated authentication as exclusively the realm of plugins, most notably through `datasette-auth-github `__.
0.44 introduces :ref:`authentication` as core Datasette concepts (`#699 `__). This makes it easier for different plugins can share responsibility for authenticating requests - you might have one plugin that handles user accounts and another one that allows automated access via API keys, for example.
You'll need to install plugins if you want full user accounts, but default Datasette can now authenticate a single root user with the new ``--root`` command-line option, which outputs a one-time use URL to :ref:`authenticate as a root actor ` (`#784 `__)::
$ datasette fixtures.db --root
http://127.0.0.1:8001/-/auth-token?token=5b632f8cd44b868df625f5a6e2185d88eea5b22237fd3cc8773f107cc4fd6477
INFO: Started server process [14973]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://127.0.0.1:8001 (Press CTRL+C to quit)
Plugins can implement new ways of authenticating users using the new :ref:`plugin_hook_actor_from_request` hook.
Permissions
~~~~~~~~~~~
Datasette also now has a built-in concept of :ref:`authentication_permissions`. The permissions system answers the following question:
Is this **actor** allowed to perform this **action**, optionally against this particular **resource**?
You can use the new ``"allow"`` block syntax in ``metadata.json`` (or ``metadata.yaml``) to set required permissions at the instance, database, table or canned query level. For example, to restrict access to the ``fixtures.db`` database to the ``"root"`` user:
.. code-block:: json
{
"databases": {
"fixtures": {
"allow": {
"id" "root"
}
}
}
}
See :ref:`authentication_permissions_allow` for more details.
Plugins can implement their own custom permission checks using the new :ref:`plugin_hook_permission_allowed` hook.
A new debug page at ``/-/permissions`` shows recent permission checks, to help administrators and plugin authors understand exactly what checks are being performed. This tool defaults to only being available to the root user, but can be exposed to other users by plugins that respond to the ``permissions-debug`` permission. (`#788 `__)
Writable canned queries
~~~~~~~~~~~~~~~~~~~~~~~
Datasette's :ref:`canned_queries` feature lets you define SQL queries in ``metadata.json`` which can then be executed by users visiting a specific URL. https://latest.datasette.io/fixtures/neighborhood_search for example.
Canned queries were previously restricted to ``SELECT``, but Datasette 0.44 introduces the ability for canned queries to execute ``INSERT`` or ``UPDATE`` queries as well, using the new ``"write": true`` property (`#800 `__):
.. code-block:: json
{
"databases": {
"dogs": {
"queries": {
"add_name": {
"sql": "INSERT INTO names (name) VALUES (:name)",
"write": true
}
}
}
}
}
See :ref:`canned_queries_writable` for more details.
Flash messages
~~~~~~~~~~~~~~
Writable canned queries needed a mechanism to let the user know that the query has been successfully executed. The new flash messaging system (`#790 `__) allows messages to persist in signed cookies which are then displayed to the user on the next page that they visit. Plugins can use this mechanism to display their own messages, see :ref:`datasette_add_message` for details.
You can try out the new messages using the ``/-/messages`` debug tool, for example at https://latest.datasette.io/-/messages
Signed values and secrets
~~~~~~~~~~~~~~~~~~~~~~~~~
Both flash messages and user authentication needed a way to sign values and set signed cookies. Two new methods are now available for plugins to take advantage of this mechanism: :ref:`datasette_sign` and :ref:`datasette_unsign`.
Datasette will generate a secret automatically when it starts up, but to avoid resetting the secret (and hence invalidating any cookies) every time the server restarts you should set your own secret. You can pass a secret to Datasette using the new ``--secret`` option or with a ``DATASETTE_SECRET`` environment variable. See :ref:`config_secret` for more details.
You can also set a secret when you deploy Datasette using ``datasette publish`` or ``datasette package`` - see :ref:`config_publish_secrets`.
Plugins can now sign value and verify their signatures using the :ref:`datasette.sign() ` and :ref:`datasette.unsign() ` methods.
CSRF protection
~~~~~~~~~~~~~~~
Since writable canned queries are built using POST forms, Datasette now ships with :ref:`internals_csrf` (`#798 `__). This applies automatically to any POST request, which means plugins need to include a ``csrftoken`` in any POST forms that they render. They can do that like so:
.. code-block:: html
Cookie methods
~~~~~~~~~~~~~~
Plugins can now use the new :ref:`response.set_cookie() ` method to set cookies.
A new ``request.cookies`` method on the :ref:internals_request` can be used to read incoming cookies.
register_routes() plugin hooks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Plugins can now register new views and routes via the :ref:`plugin_register_routes` plugin hook (`#819 `__). View functions can be defined that accept any of the current ``datasette`` object, the current ``request``, or the ASGI ``scope``, ``send`` and ``receive`` objects.
Smaller changes
~~~~~~~~~~~~~~~
- New internals documentation for :ref:`internals_request` and :ref:`internals_response`. (`#706 `__)
- ``request.url`` now respects the ``force_https_urls`` config setting. closes (`#781 `__)
- ``request.args.getlist()`` returns ``[]`` if missing. Removed ``request.raw_args`` entirely. (`#774 `__)
- New :ref:`datasette.get_database() ` method.
- Added ``_`` prefix to many private, undocumented methods of the Datasette class. (`#576 `__)
- Removed the ``db.get_outbound_foreign_keys()`` method which duplicated the behaviour of ``db.foreign_keys_for_table()``.
- New :ref:`await datasette.permission_allowed() ` method.
- ``/-/actor`` debugging endpoint for viewing the currently authenticated actor.
- New ``request.cookies`` property.
- ``/-/plugins`` endpoint now shows a list of hooks implemented by each plugin, e.g. https://latest.datasette.io/-/plugins?all=1
- ``request.post_vars()`` method no longer discards empty values.
- New "params" canned query key for explicitly setting named parameters, see :ref:`canned_queries_named_parameters`. (`#797 `__)
- ``request.args`` is now a :ref:`MultiParams ` object.
- Fixed a bug with the ``datasette plugins`` command. (`#802 `__)
- Nicer pattern for using ``make_app_client()`` in tests. (`#395 `__)
- New ``request.actor`` property.
- Fixed broken CSS on nested 404 pages. (`#777 `__)
- New ``request.url_vars`` property. (`#822 `__)
- Fixed a bug with the ``python tests/fixtures.py`` command for outputting Datasette's testing fixtures database and plugins. (`#804 `__)
- ``datasette publish heroku`` now deploys using Python 3.8.3.
- Added a warning that the :ref:`plugin_register_facet_classes` hook is unstable and may change in the future. (`#830 `__)
- The ``{"$env": "ENVIRONMENT_VARIBALE"}`` mechanism (see :ref:`plugins_configuration_secret`) now works with variables inside nested lists. (`#837 `__)
The road to Datasette 1.0
~~~~~~~~~~~~~~~~~~~~~~~~~
I've assembled a `milestone for Datasette 1.0 `__. The focus of the 1.0 release will be the following:
- Signify confidence in the quality/stability of Datasette
- Give plugin authors confidence that their plugins will work for the whole 1.x release cycle
- Provide the same confidence to developers building against Datasette JSON APIs
If you have thoughts about what you would like to see for Datasette 1.0 you can join `the conversation on issue #519 `__.
.. _v0_43:
0.43 (2020-05-28)
-----------------
The main focus of this release is a major upgrade to the :ref:`plugin_register_output_renderer` plugin hook, which allows plugins to provide new output formats for Datasette such as `datasette-atom `__ and `datasette-ics `__.
* Redesign of :ref:`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 `__, `#770 `__)
* Visually distinguish float and integer columns - useful for figuring out why order-by-column might be returning unexpected results. (`#729 `__)
* The :ref:`internals_request`, which is passed to several plugin hooks, is now documented. (`#706 `__)
* New ``metadata.json`` option for setting a custom default page size for specific tables and views, see :ref:`metadata_page_size`. (`#751 `__)
* Canned queries can now be configured with a default URL fragment hash, useful when working with plugins such as `datasette-vega `__, see :ref:`canned_queries_default_fragment`. (`#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 `__)
* 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 `__, `#773 `__)
.. _v0_42:
0.42 (2020-05-08)
-----------------
A small release which provides improved internal methods for use in plugins, along with documentation. See `#685 `__.
* Added documentation for ``db.execute()``, see :ref:`database_execute`.
* Renamed ``db.execute_against_connection_in_thread()`` to ``db.execute_fn()`` and made it a documented method, see :ref:`database_execute_fn`.
* New ``results.first()`` and ``results.single_value()`` methods, plus documentation for the ``Results`` class - see :ref:`database_results`.
.. _v0_41:
0.41 (2020-05-06)
-----------------
You can now create :ref:`custom pages ` within your Datasette instance using a custom template file. For example, adding a template file called ``templates/pages/about.html`` will result in a new page being served at ``/about`` on your instance. See the :ref:`custom pages documentation ` for full details, including how to return custom HTTP headers, redirects and status codes. (`#648 `__)
:ref:`config_dir` (`#731 `__) allows you to define a custom Datasette instance as a directory. So instead of running the following::
$ datasette one.db two.db \
--metadata.json \
--template-dir=templates/ \
--plugins-dir=plugins \
--static css:css
You can instead arrange your files in a single directory called ``my-project`` and run this::
$ datasette my-project/
Also in this release:
* New ``NOT LIKE`` table filter: ``?colname__notlike=expression``. (`#750 `__)
* Datasette now has a *pattern portfolio* at ``/-/patterns`` - e.g. https://latest.datasette.io/-/patterns. This is a page that shows every Datasette user interface component in one place, to aid core development and people building custom CSS themes. (`#151 `__)
* SQLite `PRAGMA functions `__ such as ``pragma_table_info(tablename)`` are now allowed in Datasette SQL queries. (`#761 `__)
* Datasette pages now consistently return a ``content-type`` of ``text/html; charset=utf-8"``. (`#752 `__)
* Datasette now handles an ASGI ``raw_path`` value of ``None``, which should allow compatibilty with the `Mangum `__ adapter for running ASGI apps on AWS Lambda. Thanks, Colin Dellow. (`#719 `__)
* Installation documentation now covers how to :ref:`installation_pipx`. (`#756 `__)
* Improved the documentation for :ref:`full_text_search`. (`#748 `__)
.. _v0_40:
0.40 (2020-04-21)
-----------------
* Datasette :ref:`metadata` can now be provided as a YAML file as an optional alternative to JSON. See :ref:`metadata_yaml`. (`#713 `__)
* Removed support for ``datasette publish now``, which used the the now-retired Zeit Now v1 hosting platform. A new plugin, `datasette-publish-now `__, can be installed to publish data to Zeit (`now Vercel `__) Now v2. (`#710 `__)
* Fixed a bug where the ``extra_template_vars(request, view_name)`` plugin hook was not receiving the correct ``view_name``. (`#716 `__)
* Variables added to the template context by the ``extra_template_vars()`` plugin hook are now shown in the ``?_context=1`` debugging mode (see :ref:`config_template_debug`). (`#693 `__)
* Fixed a bug where the "templates considered" HTML comment was no longer being displayed. (`#689 `__)
* Fixed a ``datasette publish`` bug where ``--plugin-secret`` would over-ride plugin configuration in the provided ``metadata.json`` file. (`#724 `__)
* Added a new CSS class for customizing the canned query page. (`#727 `__)
.. _v0_39:
0.39 (2020-03-24)
-----------------
* New :ref:`config_base_url` configuration setting for serving up the correct links while running Datasette under a different URL prefix. (`#394 `__)
* New metadata settings ``"sort"`` and ``"sort_desc"`` for setting the default sort order for a table. See :ref:`metadata_default_sort`. (`#702 `__)
* Sort direction arrow now displays by default on the primary key. This means you only have to click once (not twice) to sort in reverse order. (`#677 `__)
* New ``await Request(scope, receive).post_vars()`` method for accessing POST form variables. (`#700 `__)
* :ref:`plugin_hooks` documentation now links to example uses of each plugin. (`#709 `__)
.. _v0_38:
0.38 (2020-03-08)
-----------------
* The `Docker build `__ of Datasette now uses SQLite 3.31.1, upgraded from 3.26. (`#695 `__)
* ``datasette publish cloudrun`` now accepts an optional ``--memory=2Gi`` flag for setting the Cloud Run allocated memory to a value other than the default (256Mi). (`#694 `__)
* Fixed bug where templates that shipped with plugins were sometimes not being correctly loaded. (`#697 `__)
.. _v0_37_1:
0.37.1 (2020-03-02)
-------------------
* Don't attempt to count table rows to display on the index page for databases > 100MB. (`#688 `__)
* Print exceptions if they occur in the write thread rather than silently swallowing them.
* Handle the possibility of ``scope["path"]`` being a string rather than bytes
* Better documentation for the :ref:`plugin_hook_extra_template_vars` plugin hook.
.. _v0_37:
0.37 (2020-02-25)
-----------------
* Plugins now have a supported mechanism for writing to a database, using the new ``.execute_write()`` and ``.execute_write_fn()`` methods. :ref:`Documentation `. (`#682 `__)
* Immutable databases that have had their rows counted using the ``inspect`` command now use the calculated count more effectively - thanks, Kevin Keogh. (`#666 `__)
* ``--reload`` no longer restarts the server if a database file is modified, unless that database was opened immutable mode with ``-i``. (`#494 `__)
* New ``?_searchmode=raw`` option turns off escaping for FTS queries in ``?_search=`` allowing full use of SQLite's `FTS5 query syntax `__. (`#676 `__)
.. _v0_36:
0.36 (2020-02-21)
-----------------
* The ``datasette`` object passed to plugins now has API documentation: :ref:`internals_datasette`. (`#576 `__)
* New methods on ``datasette``: ``.add_database()`` and ``.remove_database()`` - :ref:`documentation `. (`#671 `__)
* ``prepare_connection()`` plugin hook now takes optional ``datasette`` and ``database`` arguments - :ref:`plugin_hook_prepare_connection`. (`#678 `__)
* Added three new plugins and one new conversion tool to the :ref:`ecosystem`.
.. _v0_35:
0.35 (2020-02-04)
-----------------
* Added five new plugins and one new conversion tool to the :ref:`ecosystem`.
* The ``Datasette`` class has a new ``render_template()`` method which can be used by plugins to render templates using Datasette's pre-configured `Jinja `__ templating library.
* You can now execute SQL queries that start with a ``-- comment`` - thanks, Jay Graves (`#653 `__)
.. _v0_34:
0.34 (2020-01-29)
-----------------
* ``_search=`` queries are now correctly escaped using a new ``escape_fts()`` custom SQL function. This means you can now run searches for strings like ``park.`` without seeing errors. (`#651 `__)
* `Google Cloud Run `__ is no longer in beta, so ``datasette publish cloudrun`` has been updated to work even if the user has not installed the ``gcloud`` beta components package. Thanks, Katie McLaughlin (`#660 `__)
* ``datasette package`` now accepts a ``--port`` option for specifying which port the resulting Docker container should listen on. (`#661 `__)
.. _v0_33:
0.33 (2019-12-22)
-----------------
* ``rowid`` is now included in dropdown menus for filtering tables (`#636 `__)
* Columns are now only suggested for faceting if they have at least one value with more than one record (`#638 `__)
* Queries with no results now display "0 results" (`#637 `__)
* Improved documentation for the ``--static`` option (`#641 `__)
* asyncio task information is now included on the ``/-/threads`` debug page
* Bumped Uvicorn dependency 0.11
* You can now use ``--port 0`` to listen on an available port
* New :ref:`config_template_debug` setting for debugging templates, e.g. https://latest.datasette.io/fixtures/roadside_attractions?_context=1 (`#654 `__)
.. _v0_32:
0.32 (2019-11-14)
-----------------
Datasette now renders templates using `Jinja async mode `__. This makes it easy for plugins to provide custom template functions that perform asynchronous actions, for example the new `datasette-template-sql `__ plugin which allows custom templates to directly execute SQL queries and render their results. (`#628 `__)
.. _v0_31_2:
0.31.2 (2019-11-13)
-------------------
- Fixed a bug where ``datasette publish heroku`` applications failed to start (`#633 `__)
- Fix for ``datasette publish`` with just ``--source_url`` - thanks, Stanley Zheng (`#572 `__)
- Deployments to Heroku now use Python 3.8.0 (`#632 `__)
.. _v0_31_1:
0.31.1 (2019-11-12)
-------------------
- Deployments created using ``datasette publish`` now use ``python:3.8`` base Docker image (`#629 `__)
.. _v0_31:
0.31 (2019-11-11)
-----------------
This version adds compatibility with Python 3.8 and breaks compatibility with Python 3.5.
If you are still running Python 3.5 you should stick with ``0.30.2``, which you can install like this::
pip install datasette==0.30.2
- Format SQL button now works with read-only SQL queries - thanks, Tobias Kunze (`#602 `__)
- New ``?column__notin=x,y,z`` filter for table views (`#614 `__)
- Table view now uses ``select col1, col2, col3`` instead of ``select *``
- Database filenames can now contain spaces - thanks, Tobias Kunze (`#590 `__)
- Removed obsolete ``?_group_count=col`` feature (`#504 `__)
- Improved user interface and documentation for ``datasette publish cloudrun`` (`#608 `__)
- Tables with indexes now show the ``CREATE INDEX`` statements on the table page (`#618 `__)
- Current version of `uvicorn `__ is now shown on ``/-/versions``
- Python 3.8 is now supported! (`#622 `__)
- Python 3.5 is no longer supported.
.. _v0_30_2:
0.30.2 (2019-11-02)
-------------------
- ``/-/plugins`` page now uses distribution name e.g. ``datasette-cluster-map`` instead of the name of the underlying Python package (``datasette_cluster_map``) (`#606 `__)
- Array faceting is now only suggested for columns that contain arrays of strings (`#562 `__)
- Better documentation for the ``--host`` argument (`#574 `__)
- Don't show ``None`` with a broken link for the label on a nullable foreign key (`#406 `__)
.. _v0_30_1:
0.30.1 (2019-10-30)
-------------------
- Fixed bug where ``?_where=`` parameter was not persisted in hidden form fields (`#604 `__)
- Fixed bug with .JSON representation of row pages - thanks, Chris Shaw (`#603 `__)
.. _v0_30:
0.30 (2019-10-18)
-----------------
- Added ``/-/threads`` debugging page
- Allow ``EXPLAIN WITH...`` (`#583 `__)
- Button to format SQL - thanks, Tobias Kunze (`#136 `__)
- Sort databases on homepage by argument order - thanks, Tobias Kunze (`#585 `__)
- Display metadata footer on custom SQL queries - thanks, Tobias Kunze (`#589 `__)
- Use ``--platform=managed`` for ``publish cloudrun`` (`#587 `__)
- Fixed bug returning non-ASCII characters in CSV (`#584 `__)
- Fix for ``/foo`` v.s. ``/foo-bar`` bug (`#601 `__)
.. _v0_29_3:
0.29.3 (2019-09-02)
-------------------
- Fixed implementation of CodeMirror on database page (`#560 `__)
- Documentation typo fixes - thanks, Min ho Kim (`#561 `__)
- Mechanism for detecting if a table has FTS enabled now works if the table name used alternative escaping mechanisms (`#570 `__) - for compatibility with `a recent change to sqlite-utils `__.
.. _v0_29_2:
0.29.2 (2019-07-13)
-------------------
- Bumped `Uvicorn `__ to 0.8.4, fixing a bug where the querystring was not included in the server logs. (`#559 `__)
- Fixed bug where the navigation breadcrumbs were not displayed correctly on the page for a custom query. (`#558 `__)
- Fixed bug where custom query names containing unicode characters caused errors.
.. _v0_29_1:
0.29.1 (2019-07-11)
-------------------
- Fixed bug with static mounts using relative paths which could lead to traversal exploits (`#555 `__) - thanks Abdussamet Kocak!
- Datasette can now be run as a module: ``python -m datasette`` (`#556 `__) - thanks, Abdussamet Kocak!
.. _v0_29:
0.29 (2019-07-07)
-----------------
ASGI, new plugin hooks, facet by date and much, much more...
ASGI
~~~~
`ASGI `__ is the Asynchronous Server Gateway Interface standard. I've been wanting to convert Datasette into an ASGI application for over a year - `Port Datasette to ASGI #272 `__ tracks thirteen months of intermittent development - but with Datasette 0.29 the change is finally released. This also means Datasette now runs on top of `Uvicorn `__ and no longer depends on `Sanic `__.
I wrote about the significance of this change in `Porting Datasette to ASGI, and Turtles all the way down `__.
The most exciting consequence of this change is that Datasette plugins can now take advantage of the ASGI standard.
New plugin hook: asgi_wrapper
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The :ref:`plugin_asgi_wrapper` plugin hook allows plugins to entirely wrap the Datasette ASGI application in their own ASGI middleware. (`#520 `__)
Two new plugins take advantage of this hook:
* `datasette-auth-github `__ adds a authentication layer: users will have to sign in using their GitHub account before they can view data or interact with Datasette. You can also use it to restrict access to specific GitHub users, or to members of specified GitHub `organizations `__ or `teams `__.
* `datasette-cors `__ allows you to configure `CORS headers `__ for your Datasette instance. You can use this to enable JavaScript running on a whitelisted set of domains to make ``fetch()`` calls to the JSON API provided by your Datasette instance.
New plugin hook: extra_template_vars
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The :ref:`plugin_hook_extra_template_vars` plugin hook allows plugins to inject their own additional variables into the Datasette template context. This can be used in conjunction with custom templates to customize the Datasette interface. `datasette-auth-github `__ uses this hook to add custom HTML to the new top navigation bar (which is designed to be modified by plugins, see `#540 `__).
Secret plugin configuration options
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Plugins like `datasette-auth-github `__ need a safe way to set secret configuration options. Since the default mechanism for configuring plugins exposes those settings in ``/-/metadata`` a new mechanism was needed. :ref:`plugins_configuration_secret` describes how plugins can now specify that their settings should be read from a file or an environment variable::
{
"plugins": {
"datasette-auth-github": {
"client_secret": {
"$env": "GITHUB_CLIENT_SECRET"
}
}
}
}
These plugin secrets can be set directly using ``datasette publish``. See :ref:`publish_custom_metadata_and_plugins` for details. (`#538 `__ and `#543 `__)
Facet by date
~~~~~~~~~~~~~
If a column contains datetime values, Datasette can now facet that column by date. (`#481 `__)
.. _v0_29_medium_changes:
Easier custom templates for table rows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you want to customize the display of individual table rows, you can do so using a ``_table.html`` template include that looks something like this::
{% for row in display_rows %}
{{ row["title"] }}
{{ row["description"] }}
Category: {{ row.display("category_id") }}
{% endfor %}
This is a **backwards incompatible change**. If you previously had a custom template called ``_rows_and_columns.html`` you need to rename it to ``_table.html``.
See :ref:`customization_custom_templates` for full details.
?_through= for joins through many-to-many tables
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The new ``?_through={json}`` argument to the Table view allows records to be filtered based on a many-to-many relationship. See :ref:`json_api_table_arguments` for full documentation - here's `an example `__. (`#355 `__)
This feature was added to help support `facet by many-to-many `__, which isn't quite ready yet but will be coming in the next Datasette release.
Small changes
~~~~~~~~~~~~~
* Databases published using ``datasette publish`` now open in :ref:`performance_immutable_mode`. (`#469 `__)
* ``?col__date=`` now works for columns containing spaces
* Automatic label detection (for deciding which column to show when linking to a foreign key) has been improved. (`#485 `__)
* Fixed bug where pagination broke when combined with an expanded foreign key. (`#489 `__)
* Contributors can now run ``pip install -e .[docs]`` to get all of the dependencies needed to build the documentation, including ``cd docs && make livehtml`` support.
* Datasette's dependencies are now all specified using the ``~=`` match operator. (`#532 `__)
* ``white-space: pre-wrap`` now used for table creation SQL. (`#505 `__)
`Full list of commits `__ between 0.28 and 0.29.
.. _v0_28:
0.28 (2019-05-19)
-----------------
A `salmagundi `__ of new features!
.. _v0_28_databases_that_change:
Supporting databases that change
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From the beginning of the project, Datasette has been designed with read-only databases in mind. If a database is guaranteed not to change it opens up all kinds of interesting opportunities - from taking advantage of SQLite immutable mode and HTTP caching to bundling static copies of the database directly in a Docker container. `The interesting ideas in Datasette `__ explores this idea in detail.
As my goals for the project have developed, I realized that read-only databases are no longer the right default. SQLite actually supports concurrent access very well provided only one thread attempts to write to a database at a time, and I keep encountering sensible use-cases for running Datasette on top of a database that is processing inserts and updates.
So, as-of version 0.28 Datasette no longer assumes that a database file will not change. It is now safe to point Datasette at a SQLite database which is being updated by another process.
Making this change was a lot of work - see tracking tickets `#418 `__, `#419 `__ and `#420 `__. It required new thinking around how Datasette should calculate table counts (an expensive operation against a large, changing database) and also meant reconsidering the "content hash" URLs Datasette has used in the past to optimize the performance of HTTP caches.
Datasette can still run against immutable files and gains numerous performance benefits from doing so, but this is no longer the default behaviour. Take a look at the new :ref:`performance` documentation section for details on how to make the most of Datasette against data that you know will be staying read-only and immutable.
.. _v0_28_faceting:
Faceting improvements, and faceting plugins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Datasette :ref:`facets` provide an intuitive way to quickly summarize and interact with data. Previously the only supported faceting technique was column faceting, but 0.28 introduces two powerful new capabilities: facet-by-JSON-array and the ability to define further facet types using plugins.
Facet by array (`#359 `__) is only available if your SQLite installation provides the ``json1`` extension. Datasette will automatically detect columns that contain JSON arrays of values and offer a faceting interface against those columns - useful for modelling things like tags without needing to break them out into a new table. See :ref:`facet_by_json_array` for more.
The new :ref:`plugin_register_facet_classes` plugin hook (`#445 `__) can be used to register additional custom facet classes. Each facet class should provide two methods: ``suggest()`` which suggests facet selections that might be appropriate for a provided SQL query, and ``facet_results()`` which executes a facet operation and returns results. Datasette's own faceting implementations have been refactored to use the same API as these plugins.
.. _v0_28_publish_cloudrun:
datasette publish cloudrun
~~~~~~~~~~~~~~~~~~~~~~~~~~
`Google Cloud Run `__ is a brand new serverless hosting platform from Google, which allows you to build a Docker container which will run only when HTTP traffic is received and will shut down (and hence cost you nothing) the rest of the time. It's similar to Zeit's Now v1 Docker hosting platform which sadly is `no longer accepting signups `__ from new users.
The new ``datasette publish cloudrun`` command was contributed by Romain Primet (`#434 `__) and publishes selected databases to a new Datasette instance running on Google Cloud Run.
See :ref:`publish_cloud_run` for full documentation.
.. _v0_28_register_output_renderer:
register_output_renderer plugins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Russ Garrett implemented a new Datasette plugin hook called :ref:`register_output_renderer ` (`#441 `__) which allows plugins to create additional output renderers in addition to Datasette's default ``.json`` and ``.csv``.
Russ's in-development `datasette-geo `__ plugin includes `an example `__ of this hook being used to output ``.geojson`` automatically converted from SpatiaLite.
.. _v0_28_medium_changes:
Medium changes
~~~~~~~~~~~~~~
- Datasette now conforms to the `Black coding style `__ (`#449 `__) - and has a unit test to enforce this in the future
- New :ref:`json_api_table_arguments`:
- ``?columnname__in=value1,value2,value3`` filter for executing SQL IN queries against a table, see :ref:`table_arguments` (`#433 `__)
- ``?columnname__date=yyyy-mm-dd`` filter which returns rows where the spoecified datetime column falls on the specified date (`583b22a `__)
- ``?tags__arraycontains=tag`` filter which acts against a JSON array contained in a column (`78e45ea `__)
- ``?_where=sql-fragment`` filter for the table view (`#429 `__)
- ``?_fts_table=mytable`` and ``?_fts_pk=mycolumn`` querystring options can be used to specify which FTS table to use for a search query - see :ref:`full_text_search_table_or_view` (`#428 `__)
- You can now pass the same table filter multiple times - for example, ``?content__not=world&content__not=hello`` will return all rows where the content column is neither ``hello`` or ``world`` (`#288 `__)
- You can now specify ``about`` and ``about_url`` metadata (in addition to ``source`` and ``license``) linking to further information about a project - see :ref:`metadata_source_license_about`
- New ``?_trace=1`` parameter now adds debug information showing every SQL query that was executed while constructing the page (`#435 `__)
- ``datasette inspect`` now just calculates table counts, and does not introspect other database metadata (`#462 `__)
- Removed ``/-/inspect`` page entirely - this will be replaced by something similar in the future, see `#465 `__
- Datasette can now run against an in-memory SQLite database. You can do this by starting it without passing any files or by using the new ``--memory`` option to ``datasette serve``. This can be useful for experimenting with SQLite queries that do not access any data, such as ``SELECT 1+1`` or ``SELECT sqlite_version()``.
.. _v0_28_small_changes:
Small changes
~~~~~~~~~~~~~
- We now show the size of the database file next to the download link (`#172 `__)
- New ``/-/databases`` introspection page shows currently connected databases (`#470 `__)
- Binary data is no longer displayed on the table and row pages (`#442 `__ - thanks, Russ Garrett)
- New show/hide SQL links on custom query pages (`#415 `__)
- The :ref:`extra_body_script ` plugin hook now accepts an optional ``view_name`` argument (`#443 `__ - thanks, Russ Garrett)
- Bumped Jinja2 dependency to 2.10.1 (`#426 `__)
- All table filters are now documented, and documentation is enforced via unit tests (`2c19a27 `__)
- New project guideline: master should stay shippable at all times! (`31f36e1 `__)
- Fixed a bug where ``sqlite_timelimit()`` occasionally failed to clean up after itself (`bac4e01 `__)
- We no longer load additional plugins when executing pytest (`#438 `__)
- Homepage now links to database views if there are less than five tables in a database (`#373 `__)
- The ``--cors`` option is now respected by error pages (`#453 `__)
- ``datasette publish heroku`` now uses the ``--include-vcs-ignore`` option, which means it works under Travis CI (`#407 `__)
- ``datasette publish heroku`` now publishes using Python 3.6.8 (`666c374 `__)
- Renamed ``datasette publish now`` to ``datasette publish nowv1`` (`#472 `__)
- ``datasette publish nowv1`` now accepts multiple ``--alias`` parameters (`09ef305 `__)
- Removed the ``datasette skeleton`` command (`#476 `__)
- The :ref:`documentation on how to build the documentation ` now recommends ``sphinx-autobuild``
.. _v0_27_1:
0.27.1 (2019-05-09)
-------------------
- Tiny bugfix release: don't install ``tests/`` in the wrong place. Thanks, Veit Heller.
.. _v0_27:
0.27 (2019-01-31)
-----------------
- New command: ``datasette plugins`` (:ref:`documentation `) shows you the currently installed list of plugins.
- Datasette can now output `newline-delimited JSON `__ using the new ``?_shape=array&_nl=on`` querystring option.
- Added documentation on :ref:`ecosystem`.
- Now using Python 3.7.2 as the base for the official `Datasette Docker image `__.
.. _v0_26_1:
0.26.1 (2019-01-10)
-------------------
- ``/-/versions`` now includes SQLite ``compile_options`` (`#396 `__)
- `datasetteproject/datasette `__ Docker image now uses SQLite 3.26.0 (`#397 `__)
- Cleaned up some deprecation warnings under Python 3.7
.. _v0_26:
0.26 (2019-01-02)
-----------------
- ``datasette serve --reload`` now restarts Datasette if a database file changes on disk.
- ``datasette publish now`` now takes an optional ``--alias mysite.now.sh`` argument. This will attempt to set an alias after the deploy completes.
- Fixed a bug where the advanced CSV export form failed to include the currently selected filters (`#393 `__)
.. _v0_25_2:
0.25.2 (2018-12-16)
-------------------
- ``datasette publish heroku`` now uses the ``python-3.6.7`` runtime
- Added documentation on :ref:`how to build the documentation `
- Added documentation covering :ref:`our release process `
- Upgraded to pytest 4.0.2
.. _v0_25_1:
0.25.1 (2018-11-04)
-------------------
Documentation improvements plus a fix for publishing to Zeit Now.
- ``datasette publish now`` now uses Zeit's v1 platform, to work around the new 100MB image limit. Thanks, @slygent - closes `#366 `__.
.. _v0_25:
0.25 (2018-09-19)
-----------------
New plugin hooks, improved database view support and an easier way to use more recent versions of SQLite.
- New ``publish_subcommand`` plugin hook. A plugin can now add additional ``datasette publish`` publishers in addition to the default ``now`` and ``heroku``, both of which have been refactored into default plugins. :ref:`publish_subcommand documentation `. Closes `#349 `__
- New ``render_cell`` plugin hook. Plugins can now customize how values are displayed in the HTML tables produced by Datasette's browseable interface. `datasette-json-html `__ and `datasette-render-images `__ are two new plugins that use this hook. :ref:`render_cell documentation `. Closes `#352 `__
- New ``extra_body_script`` plugin hook, enabling plugins to provide additional JavaScript that should be added to the page footer. :ref:`extra_body_script documentation `.
- ``extra_css_urls`` and ``extra_js_urls`` hooks now take additional optional parameters, allowing them to be more selective about which pages they apply to. :ref:`Documentation `.
- You can now use the :ref:`sortable_columns metadata setting ` to explicitly enable sort-by-column in the interface for database views, as well as for specific tables.
- The new ``fts_table`` and ``fts_pk`` metadata settings can now be used to :ref:`explicitly configure full-text search for a table or a view `, even if that table is not directly coupled to the SQLite FTS feature in the database schema itself.
- Datasette will now use `pysqlite3 `__ in place of the standard library ``sqlite3`` module if it has been installed in the current environment. This makes it much easier to run Datasette against a more recent version of SQLite, including the just-released `SQLite 3.25.0