diff --git a/docs/changelog.rst b/docs/changelog.rst index e0b88820..d9f48ecf 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -4,13 +4,20 @@ Changelog ========= -.. _v0_45a2: +.. _v0_45a3: -0.45a2 (2020-06-23) +0.45a3 (2020-06-27) ------------------- .. warning:: This is an **alpha** release. See :ref:`contributing_alpha_beta`. +- 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, :_timestamp_datetime_utc) + This inserts the currently authenticated actor ID and the current datetime. (`#842 `__) - New :ref:`plugin_hook_startup` plugin hook. (`#834 `__) - New :ref:`plugin_hook_canned_queries` plugin hook. See `datasette-saved-queries `__ for an example of this hook in action. (`#852 `__) - Workaround for "Too many open files" error in test runs. (`#846 `__) diff --git a/tests/fixtures.py b/tests/fixtures.py index 432a76f5..f3fdc468 100644 --- a/tests/fixtures.py +++ b/tests/fixtures.py @@ -461,7 +461,7 @@ METADATA = { "queries": { "𝐜𝐢𝐭𝐢𝐞𝐬": "select id, name from facet_cities order by id limit 1;", "pragma_cache_size": "PRAGMA cache_size;", - "magic_parameters": "select :_header_user_agent as user_agent, :_date_datetime_utc as datetime", + "magic_parameters": "select :_header_user_agent as user_agent, :_timestamp_datetime_utc as datetime", "neighborhood_search": { "sql": textwrap.dedent( """ diff --git a/tests/test_html.py b/tests/test_html.py index 6bae9f5f..c80a7685 100644 --- a/tests/test_html.py +++ b/tests/test_html.py @@ -97,9 +97,9 @@ def test_database_page(app_client): ), ("/fixtures/from_async_hook", "from_async_hook"), ("/fixtures/from_hook", "from_hook"), + ("/fixtures/magic_parameters", "magic_parameters"), ("/fixtures/neighborhood_search#fragment-goes-here", "Search neighborhoods"), ("/fixtures/pragma_cache_size", "pragma_cache_size"), - ("/fixtures/magic_parameters", "magic_parameters"), ] == sorted( [(a["href"], a.text) for a in queries_ul.find_all("a")], key=lambda p: p[0] )