Standardize on 'query string', not 'querystring', in docs

The request property is request.query_string so this is more consistent.
pull/1204/head
Simon Willison 2021-01-11 13:33:54 -08:00
rodzic 649f48cd70
commit ef2ecc1b89
12 zmienionych plików z 30 dodań i 30 usunięć

Wyświetl plik

@ -44,7 +44,7 @@ https://latest.datasette.io/fixtures/binary_data.json?_shape=array
Linking to binary downloads
---------------------------
The ``.blob`` output format is used to return binary data. It requires a ``_blob_column=`` querystring argument specifying which BLOB column should be downloaded, for example:
The ``.blob`` output format is used to return binary data. It requires a ``_blob_column=`` query string argument specifying which BLOB column should be downloaded, for example:
https://latest.datasette.io/fixtures/binary_data/1.blob?_blob_column=data

Wyświetl plik

@ -740,7 +740,7 @@ If you are still running Python 3.5 you should stick with ``0.30.2``, which you
0.29.2 (2019-07-13)
-------------------
- Bumped `Uvicorn <https://www.uvicorn.org/>`__ to 0.8.4, fixing a bug where the querystring was not included in the server logs. (`#559 <https://github.com/simonw/datasette/issues/559>`__)
- Bumped `Uvicorn <https://www.uvicorn.org/>`__ to 0.8.4, fixing a bug where the query string was not included in the server logs. (`#559 <https://github.com/simonw/datasette/issues/559>`__)
- Fixed bug where the navigation breadcrumbs were not displayed correctly on the page for a custom query. (`#558 <https://github.com/simonw/datasette/issues/558>`__)
- Fixed bug where custom query names containing unicode characters caused errors.
@ -910,7 +910,7 @@ Medium changes
- ``?columnname__date=yyyy-mm-dd`` filter which returns rows where the spoecified datetime column falls on the specified date (`583b22a <https://github.com/simonw/datasette/commit/583b22aa28e26c318de0189312350ab2688c90b1>`__)
- ``?tags__arraycontains=tag`` filter which acts against a JSON array contained in a column (`78e45ea <https://github.com/simonw/datasette/commit/78e45ead4d771007c57b307edf8fc920101f8733>`__)
- ``?_where=sql-fragment`` filter for the table view (`#429 <https://github.com/simonw/datasette/issues/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 <https://github.com/simonw/datasette/issues/428>`__)
- ``?_fts_table=mytable`` and ``?_fts_pk=mycolumn`` query string options can be used to specify which FTS table to use for a search query - see :ref:`full_text_search_table_or_view` (`#428 <https://github.com/simonw/datasette/issues/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 <https://github.com/simonw/datasette/issues/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 <https://github.com/simonw/datasette/issues/435>`__)
@ -955,7 +955,7 @@ Small changes
-----------------
- New command: ``datasette plugins`` (:ref:`documentation <plugins_installed>`) shows you the currently installed list of plugins.
- Datasette can now output `newline-delimited JSON <http://ndjson.org/>`__ using the new ``?_shape=array&_nl=on`` querystring option.
- Datasette can now output `newline-delimited JSON <http://ndjson.org/>`__ using the new ``?_shape=array&_nl=on`` query string option.
- Added documentation on :ref:`ecosystem`.
- Now using Python 3.7.2 as the base for the official `Datasette Docker image <https://hub.docker.com/r/datasetteproject/datasette/>`__.
@ -1028,7 +1028,7 @@ A number of small new features:
- ``datasette publish heroku`` now supports app names via the ``-n`` option, which can also be used to overwrite an existing application [Russ Garrett]
- Title and description metadata can now be set for :ref:`canned SQL queries <canned_queries>`, closes `#342 <https://github.com/simonw/datasette/issues/342>`_
- New ``force_https_on`` config option, fixes ``https://`` API URLs when deploying to Zeit Now - closes `#333 <https://github.com/simonw/datasette/issues/333>`_
- ``?_json_infinity=1`` querystring argument for handling Infinity/-Infinity values in JSON, closes `#332 <https://github.com/simonw/datasette/issues/332>`_
- ``?_json_infinity=1`` query string argument for handling Infinity/-Infinity values in JSON, closes `#332 <https://github.com/simonw/datasette/issues/332>`_
- URLs displayed in the results of custom SQL queries are now URLified, closes `#298 <https://github.com/simonw/datasette/issues/298>`_
.. _v0_23_2:
@ -1095,7 +1095,7 @@ for that reference (automatically or using the :ref:`label_columns` metadata
option) so it can display a link to the associated row.
This expansion is now also available for JSON and CSV representations of the
table, using the new ``_labels=on`` querystring option. See
table, using the new ``_labels=on`` query string option. See
:ref:`expand_foreign_keys` for more details.
New configuration settings
@ -1117,7 +1117,7 @@ configuration options have been added:
Control HTTP caching with ?_ttl=
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can now customize the HTTP max-age header that is sent on a per-URL basis, using the new ``?_ttl=`` querystring parameter.
You can now customize the HTTP max-age header that is sent on a per-URL basis, using the new ``?_ttl=`` query string parameter.
You can set this to any value in seconds, or you can set it to 0 to disable HTTP caching entirely.
@ -1280,7 +1280,7 @@ New JSON ``_shape=`` options, the ability to set table ``_size=`` and a mechanis
* 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>`_
- New ``?_size=XXX`` query string parameter for table view, closes `#229 <https://github.com/simonw/datasette/issues/229>`_
Also added documentation for all of the ``_special`` arguments.

Wyświetl plik

@ -71,7 +71,7 @@ The default URL for the CSV representation of a table is that table with
* https://latest.datasette.io/fixtures/facetable.json - JSON API
This pattern doesn't work for tables with names that already end in ``.csv`` or
``.json``. For those tables, you can instead use the ``_format=`` querystring
``.json``. For those tables, you can instead use the ``_format=`` query string
parameter:
* https://latest.datasette.io/fixtures/table%2Fwith%2Fslashes.csv - HTML interface

Wyświetl plik

@ -7,10 +7,10 @@ Datasette facets can be used to add a faceted browse interface to any database t
.. image:: facets.png
Facets can be specified in two ways: using querystring parameters, or in ``metadata.json`` configuration for the table.
Facets can be specified in two ways: using query string parameters, or in ``metadata.json`` configuration for the table.
Facets in querystrings
----------------------
Facets in query strings
-----------------------
To turn on faceting for specific columns on a Datasette table view, add one or more ``_facet=COLUMN`` parameters to the URL. For example, if you want to turn on facets for the ``city_id`` and ``state`` columns, construct a URL that looks like this::

Wyświetl plik

@ -14,7 +14,7 @@ Datasette automatically detects which tables have been configured for full-text
The table page and table view API
---------------------------------
Table views that support full-text search can be queried using the ``?_search=TERMS`` querystring parameter. This will run the search against content from all of the columns that have been included in the index.
Table views that support full-text search can be queried using the ``?_search=TERMS`` query string parameter. This will run the search against content from all of the columns that have been included in the index.
Try this example: `fara.datasettes.com/fara/FARA_All_ShortForms?_search=manafort <https://fara.datasettes.com/fara/FARA_All_ShortForms?_search=manafort>`__
@ -45,7 +45,7 @@ Configuring full-text search for a table or view
If a table has a corresponding FTS table set up using the ``content=`` argument to ``CREATE VIRTUAL TABLE`` shown above, Datasette will detect it automatically and add a search interface to the table page for that table.
You can also manually configure which table should be used for full-text search using querystring parameters or :ref:`metadata`. You can set the associated FTS table for a specific table and you can also set one for a view - if you do that, the page for that SQL view will offer a search option.
You can also manually configure which table should be used for full-text search using query string parameters or :ref:`metadata`. You can set the associated FTS table for a specific table and you can also set one for a view - if you do that, the page for that SQL view will offer a search option.
Use ``?_fts_table=x`` to over-ride the FTS table for a specific page. If the primary key was something other than ``rowid`` you can use ``?_fts_pk=col`` to set that as well. This is particularly useful for views, for example:

Wyświetl plik

@ -174,7 +174,7 @@ Special JSON arguments
----------------------
Every Datasette endpoint that can return JSON also accepts the following
querystring arguments:
query string arguments:
``?_shape=SHAPE``
The shape of the JSON to return, documented above.
@ -211,12 +211,12 @@ querystring arguments:
Table arguments
---------------
The Datasette table view takes a number of special querystring arguments.
The Datasette table view takes a number of special query string arguments.
Column filter arguments
~~~~~~~~~~~~~~~~~~~~~~~
You can filter the data returned by the table based on column values using a querystring argument.
You can filter the data returned by the table based on column values using a query string argument.
``?column__exact=value`` or ``?_column=value``
Returns rows where the specified column exactly matches the value.
@ -389,7 +389,7 @@ labels. The HTML interface does this by default for every detected foreign key
column - you can turn that off using ``?_labels=off``.
You can request foreign keys be expanded in JSON using the ``_labels=on`` or
``_label=COLUMN`` special querystring parameters. Here's what an expanded row
``_label=COLUMN`` special query string parameters. Here's what an expanded row
looks like::
[

Wyświetl plik

@ -177,7 +177,7 @@ Datasette defaults to displaing 100 rows per page, for both tables and views. Yo
}
}
This size can still be over-ridden by passing e.g. ``?_size=50`` in the querystring.
This size can still be over-ridden by passing e.g. ``?_size=50`` in the query string.
.. _metadata_sortable_columns:

Wyświetl plik

@ -47,9 +47,9 @@ Table
The table page is the heart of Datasette: it allows users to interactively explore the contents of a database table, including sorting, filtering, :ref:`full_text_search` and applying :ref:`facets`.
The HTML interface is worth spending some time exploring. As with other pages, you can return the JSON data by appending ``.json`` to the URL path, before any `?` querystring arguments.
The HTML interface is worth spending some time exploring. As with other pages, you can return the JSON data by appending ``.json`` to the URL path, before any `?` query string arguments.
The querystring arguments are described in more detail here: :ref:`table_arguments`
The query string arguments are described in more detail here: :ref:`table_arguments`
You can also use the table page to interactively construct a SQL query - by applying different filters and a sort order for example - and then click the "View and edit SQL" link to see the SQL query that was used for the page and edit and re-submit it.

Wyświetl plik

@ -54,18 +54,18 @@ More significantly, it allows you to run Datasette behind a caching proxy such a
Using a caching proxy in this way could enable a Datasette-backed visualization to serve thousands of hits a second while running Datasette itself on extremely inexpensive hosting.
Datasette's integration with HTTP caches can be enabled using a combination of configuration options and querystring arguments.
Datasette's integration with HTTP caches can be enabled using a combination of configuration options and query string arguments.
The :ref:`setting_default_cache_ttl` setting sets the default HTTP cache TTL for all Datasette pages. This is 5 seconds unless you change it - you can set it to 0 if you wish to disable HTTP caching entirely.
You can also change the cache timeout on a per-request basis using the ``?_ttl=10`` querystring parameter. This can be useful when you are working with the Datasette JSON API - you may decide that a specific query can be cached for a longer time, or maybe you need to set ``?_ttl=0`` for some requests for example if you are running a SQL ``order by random()`` query.
You can also change the cache timeout on a per-request basis using the ``?_ttl=10`` query string parameter. This can be useful when you are working with the Datasette JSON API - you may decide that a specific query can be cached for a longer time, or maybe you need to set ``?_ttl=0`` for some requests for example if you are running a SQL ``order by random()`` query.
Hashed URL mode
---------------
When you open a database file in immutable mode using the ``-i`` option, Datasette calculates a SHA-256 hash of the contents of that file on startup. This content hash can then optionally be used to create URLs that are guaranteed to change if the contents of the file changes in the future. This results in URLs that can then be cached indefinitely by both browsers and caching proxies - an enormous potential performance optimization.
You can enable these hashed URLs in two ways: using the :ref:`setting_hash_urls` configuration setting (which affects all requests to Datasette) or via the ``?_hash=1`` querystring parameter (which only applies to the current request).
You can enable these hashed URLs in two ways: using the :ref:`setting_hash_urls` configuration setting (which affects all requests to Datasette) or via the ``?_hash=1`` query string parameter (which only applies to the current request).
With hashed URLs enabled, any request to e.g. ``/mydatabase/mytable`` will 302 redirect to ``mydatabase-455fe3a/mytable``. The URL containing the hash will be served with a very long cache expire header - configured using :ref:`setting_default_cache_ttl_hashed` which defaults to 365 days.

Wyświetl plik

@ -64,7 +64,7 @@ The following options can be set using ``--setting name value``, or by storing t
default_page_size
~~~~~~~~~~~~~~~~~
The default number of rows returned by the table page. You can over-ride this on a per-page basis using the ``?_size=80`` querystring parameter, provided you do not specify a value higher than the ``max_returned_rows`` setting. You can set this default using ``--setting`` like so::
The default number of rows returned by the table page. You can over-ride this on a per-page basis using the ``?_size=80`` query string parameter, provided you do not specify a value higher than the ``max_returned_rows`` setting. You can set this default using ``--setting`` like so::
datasette mydatabase.db --setting default_page_size 50
@ -79,7 +79,7 @@ If this time limit is too short for you, you can customize it using the ``sql_ti
datasette mydatabase.db --setting sql_time_limit_ms 3500
You can optionally set a lower time limit for an individual query using the ``?_timelimit=100`` querystring argument::
You can optionally set a lower time limit for an individual query using the ``?_timelimit=100`` query string argument::
/my-database/my-table?qSpecies=44&_timelimit=100
@ -172,7 +172,7 @@ Should users be able to download the original SQLite database using a link on th
default_cache_ttl
~~~~~~~~~~~~~~~~~
Default HTTP caching max-age header in seconds, used for ``Cache-Control: max-age=X``. Can be over-ridden on a per-request basis using the ``?_ttl=`` querystring parameter. Set this to ``0`` to disable HTTP caching entirely. Defaults to 5 seconds.
Default HTTP caching max-age header in seconds, used for ``Cache-Control: max-age=X``. Can be over-ridden on a per-request basis using the ``?_ttl=`` query string parameter. Set this to ``0`` to disable HTTP caching entirely. Defaults to 5 seconds.
::

Wyświetl plik

@ -272,14 +272,14 @@ For example:
You can use ``"params"`` to explicitly list the named parameters that should be displayed as form fields - otherwise they will be automatically detected.
You can pre-populate form fields when the page first loads using a querystring, e.g. ``/mydatabase/add_name?name=Prepopulated``. The user will have to submit the form to execute the query.
You can pre-populate form fields when the page first loads using a query string, e.g. ``/mydatabase/add_name?name=Prepopulated``. The user will have to submit the form to execute the query.
.. _canned_queries_magic_parameters:
Magic parameters
~~~~~~~~~~~~~~~~
Named parameters that start with an underscore are special: they can be used to automatically add values created by Datasette that are not contained in the incoming form fields or querystring.
Named parameters that start with an underscore are special: they can be used to automatically add values created by Datasette that are not contained in the incoming form fields or query string.
Available magic parameters are:

Wyświetl plik

@ -233,7 +233,7 @@ def test_add_filter_redirects(app_client):
assert response.status == 302
assert response.headers["Location"].endswith("?content__startswith=x")
# Adding a redirect to an existing querystring:
# Adding a redirect to an existing query string:
path = path_base + "?foo=bar&" + filter_args
response = app_client.get(path, allow_redirects=False)
assert response.status == 302