Wykres commitów

973 Commity (main)

Autor SHA1 Wiadomość Data
Simon Willison b29e487bc3 actor_from_request for dstok_ tokens, refs #1852 2022-10-25 19:18:41 -07:00
Simon Willison 7ab091e8ef Tests and docs for /-/create-token, refs #1852 2022-10-25 19:04:05 -07:00
Simon Willison f9ae92b377 Poll until servers start, refs #1854 2022-10-25 16:03:36 -07:00
Simon Willison c7dd76c262 Poll until servers start, refs #1854 2022-10-25 12:42:45 -07:00
Simon Willison 9676b2deb0 Upgrade Docker images to Python 3.11, closes #1853 2022-10-25 12:04:53 -07:00
Simon Willison 02ae1a0029 Upgrade Docker images to Python 3.11, closes #1853 2022-10-25 12:04:25 -07:00
Simon Willison 5be86d48b2 Fix display of padlocks on database page, closes #1848 2022-10-23 19:42:30 -07:00
Simon Willison 78dad236df
check_visibility can now take multiple permissions into account
Closes #1829
2022-10-23 19:11:33 -07:00
Simon Willison 6887c12ea3 Workaround for 'too many open files' error, refs #1843 2022-10-23 15:17:33 -07:00
Simon Willison 79aa0de083 Test that breadcrumbs respect permissions, closes #1831 2022-10-13 14:51:59 -07:00
Simon Willison 1a5e5f2aa9 Refactor breadcrumbs to respect permissions, refs #1831 2022-10-13 14:42:52 -07:00
Simon Willison b7fec7f902 .sqlite/.sqlite3 extensions for config directory mode
Closes #1646
2022-10-07 16:03:30 -07:00
Simon Willison bbf33a7635 Test for bool(results), closes #1832 2022-10-04 21:32:29 -07:00
Simon Willison 5f9f567acb Show SQL query when reporting time limit error, closes #1819 2022-09-26 16:06:01 -07:00
Simon Willison cb1e093fd3 Fixed error message, closes #1816 2022-09-19 18:15:40 -07:00
Simon Willison df851c117d Validate settings.json keys on startup, closes #1816
Refs #1814
2022-09-19 16:46:39 -07:00
Simon Willison ddc999ad12 Async support for prepare_jinja2_environment, closes #1809 2022-09-16 20:38:24 -07:00
Simon Willison b40872f5e5 prepare_jinja2_environment(datasette) argument, refs #1809 2022-09-14 14:31:54 -07:00
Simon Willison fb7e70d5e7 Database(is_mutable=) now defaults to True, closes #1808
Refs https://github.com/simonw/datasette-upload-dbs/issues/6
2022-09-09 09:19:20 -07:00
Simon Willison 5aa359b869 Apply cell truncation on query page too, refs #1805 2022-09-06 16:58:30 -07:00
Simon Willison d0737e4de5 truncate_cells_html now affects URLs too, refs #1805 2022-09-06 16:50:43 -07:00
Simon Willison 8430c3bc7d table facet_size in metadata, refs #1804 2022-09-06 08:59:19 -07:00
Simon Willison 64288d827f
Workaround for test failure: RuntimeError: There is no current event loop (#1803)
* Remove ensure_eventloop hack
* Hack to recover from intermittent RuntimeError calling asyncio.Lock()
2022-09-05 17:40:19 -07:00
Simon Willison b2b901e8c4 Skip SpatiaLite test if no conn.enable_load_extension()
Ran into this problem while working on #1802
2022-09-05 17:09:57 -07:00
Simon Willison ba35105eee
Test `--load-extension` in GitHub Actions (#1792)
* Run the --load-extension test, refs #1789
* Ran cog, refs #1789
2022-08-23 17:11:45 -07:00
Alex Garcia 1d64c9a8da
Add new entrypoint option to --load-extensions. (#1789)
Thanks, @asg017
2022-08-23 11:34:30 -07:00
Simon Willison a3e6f1b167 Increase height of non-JS textarea to fit query
Closes #1786
2022-08-18 09:06:02 -07:00
Simon Willison 82167105ee --min-instances and --max-instances Cloud Run publish options, closes #1779 2022-08-14 10:07:30 -07:00
Simon Willison c1396bf860 Don't allow canned write queries on immutable DBs, closes #1728 2022-08-14 09:34:31 -07:00
Simon Willison 1563c22a8c Don't duplicate _sort_desc, refs #1738 2022-08-14 09:13:12 -07:00
Simon Willison 080d4b3e06 Switch to python:3.10.6-slim-bullseye for datasette publish - refs #1768 2022-08-14 08:49:14 -07:00
Simon Willison df4fd2d7dd _sort= works even if sort column not selected, closes #1773 2022-08-14 08:44:02 -07:00
Chris Amico 01369176b0
Keep track of datasette.config_dir (#1766)
Thanks, @eyeseast - closes #1764
2022-07-17 18:12:45 -07:00
Simon Willison c09c53f345 New handle_exception plugin hook, refs #1770
Also refs:
- https://github.com/simonw/datasette-sentry/issues/1
- https://github.com/simonw/datasette-show-errors/issues/2
2022-07-17 16:24:39 -07:00
Simon Willison 6373bb3414 Expose current SQLite row to render_cell hook, closes #1300 2022-07-07 09:30:49 -07:00
Simon Willison 7d1e004ff6 Fix test I broke in #1744 2022-05-17 13:09:07 -07:00
Simon Willison 280ff372ab ETag support for .db downloads, closes #1739 2022-05-03 07:59:46 -07:00
Simon Willison 3f00a29141
Clean up compatibility with Pyodide (#1736)
* Optional uvicorn import for Pyodide, refs #1733
* --setting num_sql_threads 0 to disable threading, refs #1735
2022-05-02 13:15:27 -07:00
Simon Willison 687907aa2b Remove python-baseconv dependency, refs #1733, closes #1734 2022-05-02 12:39:06 -07:00
Tim Sherratt 3001e1e394
Add timeout option to Cloudrun build (#1717)
* Add timeout option for build phase
* Make the --timeout setting optional
* Add test for --timeout setting

Thanks, @wragge
2022-04-24 07:03:08 -07:00
Simon Willison 0bc5186b7b Tooltip and commas for byte length display, closes #1712 2022-04-12 11:44:12 -07:00
Simon Willison 90d1be9952 Tilde encoding now encodes space as plus, closes #1701
Refs #1657
2022-04-06 08:55:01 -07:00
Simon Willison 5c5e9b3657 Request.fake(... url_vars), plus .fake() is now documented
Also made 'from datasette import Request' shortcut work.

Closes #1697
2022-03-31 19:01:58 -07:00
Simon Willison c496f2b663 Don't show facet in cog menu if not allow_facet, closes #1683 2022-03-24 12:16:19 -07:00
Simon Willison 0159662ab8 Fix for bug running ?sql= against databases with a different route, closes #1682 2022-03-23 11:48:10 -07:00
Simon Willison 194e4f6c3f Removed check_permission() from BaseView, closes #1677
Refs #1660
2022-03-21 11:41:56 -07:00
Simon Willison cdbae2b93f Fixed internal links to respect db.route, refs #1668 2022-03-19 17:31:23 -07:00
Simon Willison 7a6654a253 Databases can now have a .route separate from their .name, refs #1668 2022-03-19 17:11:17 -07:00
Simon Willison 798f075ef9 Read format from route captures, closes #1667
Refs #1660
2022-03-19 13:32:29 -07:00
Simon Willison b9c2b1cfc8 Consistent treatment of format in route capturing, refs #1667
Also refs #1660
2022-03-19 13:29:10 -07:00
Simon Willison 61419388c1 Rename route match groups for consistency, refs #1667, #1660 2022-03-19 09:52:08 -07:00
Simon Willison 764738dfcb test_routes also now asserts matches, refs #1666 2022-03-19 09:30:22 -07:00
Simon Willison 711767bcd3 Refactored URL routing to add tests, closes #1666
Refs #1660
2022-03-18 21:03:08 -07:00
Simon Willison 4e47a2d894 Fixed bug where tables with a column called n caused 500 errors
Closes #1228
2022-03-18 18:37:54 -07:00
Simon Willison 9979dcd07f Also remove default_cache_ttl_hashed setting, refs #1661 2022-03-18 17:25:14 -07:00
Simon Willison 8658c66438 Show error if --setting hash_urls 1 used, refs #1661 2022-03-18 17:19:31 -07:00
Simon Willison d4f60c2388
Remove hashed URL mode
Also simplified how view class routing works.

Refs #1661
2022-03-18 17:12:03 -07:00
Simon Willison a35393b29c
Tilde encoding (#1659)
Closes #1657

Refs #1439
2022-03-15 11:01:57 -07:00
Simon Willison 77e718c3ff Revert "Fix bug with percentage redirects, close #1650"
This reverts commit c85d669de3.

Refs #1658
2022-03-15 08:37:31 -07:00
Simon Willison 5a353a32b9 Revert "Fixed tests for urlsafe_components, refs #1650"
This reverts commit bb499942c1.

Refs #1658
2022-03-15 08:37:14 -07:00
Simon Willison bb499942c1 Fixed tests for urlsafe_components, refs #1650 2022-03-07 11:33:31 -08:00
Simon Willison c85d669de3 Fix bug with percentage redirects, close #1650 2022-03-07 11:26:08 -08:00
Simon Willison 020effe47b Preserve query string in % to - redirects, refs #1650 2022-03-07 08:18:07 -08:00
Simon Willison 644d25d1de Redirect old % URLs to new - encoded URLs, closes #1650
Refs #1439
2022-03-07 08:01:42 -08:00
Simon Willison 1baa030eca
Switch to dash encoding for table/database/row-pk in paths
* Dash encoding functions, tests and docs, refs #1439
* dash encoding is now like percent encoding but with dashes
* Use dash-encoding for row PKs and ?_next=, refs #1439
* Use dash encoding for table names, refs #1439
* Use dash encoding for database names, too, refs #1439

See also https://simonwillison.net/2022/Mar/5/dash-encoding/
2022-03-07 07:38:29 -08:00
Simon Willison 5010d1359b Fix for test failure caused by SQLite 3.37.0+, closes #1647 2022-03-05 11:46:59 -08:00
Simon Willison 458f03ad3a More SpatiaLite details on /-/versions, closes #1607 2022-02-08 22:32:19 -08:00
Simon Willison 0cd982fc6a De-duplicate 'datasette db.db db.db', closes #1632
Refs https://github.com/simonw/datasette-publish-fly/pull/12
2022-02-07 15:28:59 -08:00
Simon Willison d9b508ffaa @documented decorator plus unit test plus sphinx.ext.autodoc
New mechanism for marking datasette.utils functions that should be covered by the
documentation, then testing that they have indeed been documented.

Also enabled sphinx.ext.autodoc which can now be used to embed the documented
versions of those functions.

Refs #1176
2022-02-06 22:31:06 -08:00
Simon Willison 8a25ea9bca Implemented import shortcuts, closes #957 2022-02-05 22:34:33 -08:00
Simon Willison da53e0360d tracer.trace_child_tasks() for asyncio.gather tracing
Also added documentation for datasette.tracer module.

Closes #1576
2022-02-04 21:19:49 -08:00
Simon Willison ac239d34ab Refactor test_trace into separate test module, refs #1576 2022-02-04 20:45:13 -08:00
Simon Willison 23a09b0f6a Remove JSON rel=alternate from some pages, closes #1623 2022-02-02 13:48:52 -08:00
Simon Willison 8d5779acf0 Refactored alternate_url_json mechanism, refs #1620, #1533 2022-02-02 13:32:47 -08:00
Simon Willison b72b2423c7 rel=alternate JSON for queries and database pages, closes #1620 2022-02-02 13:22:45 -08:00
Simon Willison 3ef47a0896 Link rel=alternate header for tables and rows
Also added Access-Control-Expose-Headers: Link to --cors mode.

Closes #1533

Refs https://github.com/simonw/datasette-notebook/issues/2

LL#	metadata.json.1
2022-02-01 23:49:09 -08:00
Simon Willison 68cc1e2dbb Move queries to top of database page, refs #1612 2022-01-25 10:28:15 -08:00
Simon Willison 7c67483f5e Make test_favicon flexible to changing icon sizes, refs #1603 2022-01-19 21:57:14 -08:00
Simon Willison 0467723ee5 New, improved favicon - refs #1603 2022-01-19 21:46:03 -08:00
Simon Willison e1770766ce Return plugins and hooks in predictable order 2022-01-19 21:14:04 -08:00
Simon Willison 58652dd925 Hidden tables sqlite1/2/3/4, closes #1587 2022-01-19 20:12:46 -08:00
Simon Willison 3664ddd400 Replace update-docs-help.py with cog, closes #1598 2022-01-13 16:47:53 -08:00
Simon Willison ab7d6a7179 Updated settings help URL to avoid redirect 2022-01-13 16:38:16 -08:00
Simon Willison 3a0f7d6488 Fixed hidden form fields bug #1527 2022-01-13 16:27:21 -08:00
Simon Willison 3658e57ac2 Fixed bug with table title element, closes #1560 2022-01-13 14:20:07 -08:00
Simon Willison 63537dd3de Allow 'explain query plan' with more whitespace, closes #1588 2022-01-13 12:34:55 -08:00
Simon Willison 8c401ee0f0 Fixed remaining code and docs for new block=True default, closes #1579 2021-12-23 11:18:20 -08:00
Simon Willison 00a2895cd2 execute_write defaut is now block=True, closes #1579 2021-12-23 11:03:49 -08:00
Simon Willison 4094741c28 Fixed bug with custom templates for writable canned queries, closes #1547 2021-12-19 13:11:57 -08:00
Simon Willison 5fac26aa22 Another populate_schema_tables optimization, refs #1555 2021-12-19 12:54:12 -08:00
Simon Willison f65817000f Include count in execute_write_many traces, closes #1571 2021-12-19 12:30:34 -08:00
Simon Willison d637ed4676 Use execute_write_many to optimize internal DB, refs #1555, #1570 2021-12-18 11:11:08 -08:00
Simon Willison 5cadc24489 db.execute_write_script() and db.execute_write_many(), closes #1570
Refs #1555
2021-12-18 10:57:22 -08:00
Simon Willison 2e4ba71b53 Optimize create table calls using executescript=True
Refs #1555, #1569
2021-12-18 10:34:15 -08:00
Simon Willison 9e094b7c9d db.execute_write(executescript=True) option, closes #1569 2021-12-18 10:34:15 -08:00
Simon Willison f81d9d0cd9 Trace write SQL queries in addition to read ones, closes #1568 2021-12-17 18:42:29 -08:00
Simon Willison 7c8f8aa209 Documentation for Datasette() constructor, closes #1563 2021-12-17 18:19:36 -08:00
Simon Willison 3a0cae4d7f Fix bug introduced by refactor in c35b84a2aa 2021-12-17 18:19:09 -08:00
Simon Willison 359140ceda Datasette() constructor no longer requires files=, closes #1563 2021-12-17 18:09:00 -08:00
Simon Willison 83bacfa945 Call _prepare_connection() on write connections, closes #1564 2021-12-17 17:58:39 -08:00
Simon Willison c35b84a2aa Remove undocumented sqlite_functions mechanism, closes #1567 2021-12-17 17:54:39 -08:00
Simon Willison aa7f0037a4
filters_from_request plugin hook, now used in TableView
- New `filters_from_request` plugin hook, closes #473
- Used it to extract the logic from TableView that handles `_search` and
`_through` and `_where` - refs #1518

Also needed for this plugin work: https://github.com/simonw/datasette-leaflet-freedraw/issues/7
2021-12-17 11:02:14 -08:00
Simon Willison 0d4145d0f4 Additional test for #625 2021-12-16 12:30:31 -08:00
Simon Willison 95d0dd7a1c Fix for colliding facet types bug, closes #625
Refs #830
2021-12-16 12:12:04 -08:00
Simon Willison 992496f261 ?_nosuggest=1 parameter for table views, closes #1557 2021-12-16 11:24:54 -08:00
Simon Willison 20a2ed6bec Fixed bug with metadata config of array/date facets, closes #1552
Thanks @davidbgk for spotting the fix for the bug.
2021-12-16 10:47:40 -08:00
Simon Willison eb53837d2a Always show count of distinct facet values, closes #1556
Refs #1423
2021-12-15 09:58:01 -08:00
Simon Willison 4f02c8d4d7 Test for JSON in query_string name, refs #621
Plus simplified implementation of test_request_blank_values
2021-12-14 12:29:05 -08:00
Simon Willison a6ff123de5 keep_blank_values=True when parsing query_string, closes #1551
Refs #1518
2021-12-12 12:01:51 -08:00
Simon Willison 492f9835aa Refactor table view API tests to test_table_api.py
Refs #1518
2021-12-11 19:07:19 -08:00
Simon Willison 1876975e3b Refactor table view HTML tests to test_table_html.py
Refs #1518
2021-12-11 19:06:45 -08:00
Simon Willison ca66246438 Updated JSON foreign key tables test for #1525 2021-11-29 22:45:04 -08:00
Simon Willison 35b12746ba Fixed CSV test I broke in #1525 2021-11-29 22:37:22 -08:00
Simon Willison a37ee74891 Correct link to _ prefix on row page, closes #1525 2021-11-29 22:34:31 -08:00
Simon Willison 69244a617b Rename city_id to _city_id in fixtures, refs #1525 2021-11-29 22:20:42 -08:00
Simon Willison 06762776f7 Fix for incorrect hidden for fields for _columns, refs #1527 2021-11-29 19:04:35 -08:00
Simon Willison 08947fa764 Fix more broken base_url links
Refs #1519, #838
2021-11-20 11:03:08 -08:00
Simon Willison fe687fd020 Fixed a whole bunch of broken base_url links
Refs #1519, #838
2021-11-19 16:53:11 -08:00
Simon Willison c617e1769e Fixed test I broke with new repr() in ##1519 2021-11-19 15:13:17 -08:00
Simon Willison ff0dd4da38 repr() method for Request, refs #1519 2021-11-19 12:29:37 -08:00
Simon Willison 6e971b4ac1 Test confirming plugins can over-ride default routes, closes #1517 2021-11-18 19:07:21 -08:00
Simon Willison 55024b5301 _facet_array no longer confused by duplicate array items, closes #448 2021-11-15 17:19:33 -08:00
Simon Willison 07044bd130 SQL view-friendly arraycontains/arraynotcontains implementation, refs #448 2021-11-15 15:41:07 -08:00
Simon Willison 1c13e1af06 Ensure query columns are included too, ref #1503 2021-11-13 21:08:33 -08:00
Simon Willison c9e3cfecc8 Columns in filters now ignore ?_nocol, closes #1503 2021-11-13 20:53:00 -08:00
Simon Willison c306b696de Correct facet links for columns with a leading underscore, closes #1506 2021-11-13 20:44:54 -08:00
Simon Willison 8584993529 --cors Access-Control-Allow-Headers: Authorization
Refs #1467, refs https://github.com/simonw/datasette-auth-tokens/issues/4
2021-10-14 12:03:28 -07:00
Simon Willison b267b57754
Upgrade to httpx 0.20
* Upgrade to httpx 0.20, closes #1488
* TestClient.post() should not default to following redirects
2021-10-14 11:03:44 -07:00
Simon Willison b50bf5d13f Don't persist _next in hidden field, closes #1483 2021-10-13 14:08:06 -07:00
Simon Willison 875117c343 Fix bug with ?_next=x&_sort=rowid, closes #1470 2021-10-09 18:14:56 -07:00
Simon Willison 1163da8916 Update test to handle Python 3.10 error message differenc, refs #1482 2021-10-08 17:32:52 -07:00
Simon Willison 30c18576d6 register_commands() plugin hook, closes #1449 2021-08-27 18:39:42 -07:00
Simon Willison adb5b70de5 Show count of facet values if ?_facet_size=max, closes #1423 2021-08-16 11:56:32 -07:00
Simon Willison ca4f83dc7b Rename config= to settings=, refs #1432 2021-08-12 18:10:36 -07:00
Simon Willison 77f46297a8 Rename --help-config to --help-settings, closes #1431 2021-08-12 18:01:57 -07:00
Simon Willison e837095ef3
Column metadata, closes #942 2021-08-12 16:53:23 -07:00
Simon Willison b1fed48a95 derive_named_parameters falls back to regex on SQL error, refs #1421 2021-08-08 20:26:08 -07:00
Simon Willison fc4846850f New way of deriving named parameters using explain, refs #1421 2021-08-08 20:21:13 -07:00
Simon Willison f3c9edb376 Fixed some tests I broke in #1425 2021-08-08 16:11:40 -07:00
Simon Willison 818b0b76a2 Test table render_cell async as well as query results, refs #1425 2021-08-08 16:07:52 -07:00
Simon Willison 3bb6409a6c render_cell() can now return an awaitable, refs 2021-08-08 16:05:00 -07:00
Simon Willison 66e143c76e New hide_sql canned query option, refs #1422 2021-08-06 22:17:36 -07:00
Simon Willison a1f3830356 --cpu option for datasette publish cloudrun, closes #1420 2021-08-03 22:20:50 -07:00
Simon Willison a679d0de87 Fixed spelling of 'receive' in a bunch of places 2021-08-03 09:11:18 -07:00
Simon Willison 4adca0d850 No hidden SQL on canned query pages, closes #1411 2021-07-31 17:58:11 -07:00
Simon Willison ff253f5242 Replace all uses of runner.isolated_filesystem, refs #1406 2021-07-31 11:49:08 -07:00
Simon Willison 96b1d0b7b4 Attempted fix for too-long UDS bug in #1407 2021-07-31 11:48:33 -07:00
Simon Willison b46856391d pytest.mark.serial for any test using isolated_filesystem(), refs #1406 2021-07-30 16:46:41 -07:00
Simon Willison e55cd9dc3f Try passing a directory to isolated_filesystem(), refs #1406 2021-07-29 18:16:58 -07:00
Simon Willison 2b1c535c12 pytest.mark.serial for any test using isolated_filesystem(), refs #1406 2021-07-29 17:44:16 -07:00
Simon Willison 121e10c29c Doumentation and test for utils.parse_metadata(), closes #1405 2021-07-29 16:30:12 -07:00
Simon Willison eccfeb0871 register_routes() plugin hook datasette argument, closes #1404 2021-07-26 16:16:46 -07:00
Simon Willison de2a106328 Ran Black, refs #1388 2021-07-10 16:46:49 -07:00
Simon Willison 180c7a5328 --uds option for binding to Unix domain socket, closes #1388 2021-07-10 16:37:30 -07:00
Simon Willison e0064ba7b0 Fixes for test_generated_columns_are_visible_in_datasette, refs #1391 2021-07-10 12:14:14 -07:00
Simon Willison 2e8d924cdc Refactored generated_columns test, no longer in fixtures.db - refs #1391 2021-07-10 12:03:19 -07:00
Simon Willison 83f6799a96 searchmode: raw table metadata property, closes #1389 2021-07-10 11:33:08 -07:00
Simon Willison 05a312caf3 Applied Black, refs #1368 2021-06-26 15:25:28 -07:00
Brandon Roberts baf986c871
New get_metadata() plugin hook for dynamic metadata
The following hook is added:

    get_metadata(
      datasette=self, key=key, database=database, table=table,
      fallback=fallback
    )

This gets called when we're building our metdata for the rest
of the system to use. We merge whatever the plugins return
with any local metadata (from metadata.yml/yaml/json) allowing
for a live-editable dynamic Datasette.

As a security precation, local meta is *not* overwritable by
plugin hooks. The workflow for transitioning to live-meta would
be to load the plugin with the full metadata.yaml and save.
Then remove the parts of the metadata that you want to be able
to change from the file.

* Avoid race condition: don't mutate databases list

This avoids the nasty "RuntimeError: OrderedDict mutated during
iteration" error that randomly happens when a plugin adds a
new database to Datasette, using `add_database`. This change
makes the add and remove database functions more expensive, but
it prevents the random explosion race conditions that make for
confusing user experience when importing live databases.

Thanks, @brandonrobertz
2021-06-26 15:24:54 -07:00
Simon Willison 02b19c7a9a Removed rogue pdb=True, refs #1377 2021-06-23 15:50:48 -07:00
Simon Willison b1fd24ac9f skip_csrf(datasette, scope) plugin hook, refs #1377 2021-06-23 15:40:09 -07:00
Simon Willison 4a3e8561ab Default 405 for POST, plus tests 2021-06-23 15:40:09 -07:00
Chris Amico a6c55afe8c
Ensure db.path is a string before trying to insert into internal database (#1370)
Thanks, @eyeseast
2021-06-21 08:57:38 -07:00
Simon Willison d23a267138 Make request available to menu plugin hooks, closes #1371 2021-06-09 21:45:24 -07:00
Simon Willison 03ec71193b Don't truncate list of columns on /db page, closes #1364 2021-06-06 15:07:45 -07:00
Simon Willison 030deb4b25 Try to handle intermittent FileNotFoundError in tests
Refs #1361
2021-06-05 16:02:03 -07:00
Simon Willison 8f311d6c1d Correctly escape output of ?_trace, refs #1360 2021-06-05 15:03:38 -07:00
Simon Willison ff29dd55fa ?_trace=1 now depends on trace_debug setting, closes #1359 2021-06-05 13:18:37 -07:00
Simon Willison a634121525
Make custom pages compatible with base_url setting
Closes #1238

- base_url no longer causes custom page routing to fail
- new route_path key in request.scope storing the path that was used for routing with the base_url prefix stripped
- TestClient used by tests now avoids accidentally double processing of the base_url prefix
2021-06-05 11:59:54 -07:00
Simon Willison d5d387abfe Applied Black, refs #1305 2021-06-01 21:30:44 -07:00
Simon Willison 80d8b0eb41 Test demonstrating fixed #1305, refs #1306 2021-06-01 21:26:25 -07:00
Simon Willison f40d1b99d6 Don't show '0 results' on error page, refs #619 2021-06-01 21:09:10 -07:00
Simon Willison ea5b237800 Show error message on bad query, closes #619 2021-06-01 20:59:29 -07:00
Simon Willison 9552414e1f
Re-display user's query with an error message if an error occurs (#1346)
* Ignore _shape when returning errors
2021-06-01 20:46:20 -07:00
Simon Willison 0f1e47287c Fixed bug with detect_fts for table with single quote in name, closes #1257 2021-06-01 20:27:04 -07:00
Simon Willison 807de378d0 /-/databases and homepage maintain connection order, closes #1216 2021-06-01 20:10:15 -07:00
Simon Willison 0539bf0816 Don't execute facets/counts for _shape=array or object, closes #263 2021-06-01 19:53:00 -07:00
Simon Willison a18e8641bc Don't reflect nofacet=1 and nocount=1 in BLOB URLs, refs #1353 2021-06-01 15:35:33 -07:00
Simon Willison fd368d3b2c New _nocount=1 option, used to speed up CSVs - closes #1353 2021-06-01 09:12:32 -07:00
Simon Willison 8bde6c5461 Rename ?_nofacets=1 to ?_nofacet=1, refs #1353 2021-06-01 08:56:00 -07:00
Simon Willison d1d06ace49 ?_trac=1 for CSV, plus ?_nofacets=1 when rendering CSV
Closes #1351, closes #1350
2021-06-01 08:49:50 -07:00
Simon Willison c5ae1197a2 ?_nofacets=1 option, closes #1350 2021-05-30 22:39:14 -04:00
Simon Willison f7d3e76fb3 Facets now execute ignoring ?_col and ?_nocol, fixes #1345 2021-05-30 22:31:14 -04:00
Simon Willison 4545120c92 Test and docs for ?_facet_size=max, refs #1337 2021-05-27 09:04:26 -07:00
Simon Willison 7e983fede6 ?_facet_size=max, ... now links to that, closes #1337
Refs #1332
2021-05-27 09:00:58 -07:00
Simon Willison f1c29fd6a1
?_col=/?_nocol= to show/hide columns on the table page
Closes #615

* Cog icon for hiding columns
* Show all columns cog menu item
* Do not allow hide column on primary keys
* Allow both ?_col= and ?_nocol=
* De-duplicate if ?_col= passed multiple times
* 400 error if user tries to ?_nocol= a primary key
* Documentation for ?_col= and ?_nocol=
2021-05-26 21:17:43 -07:00
Simon Willison 2bd9d54b27 Fix Jinja warnings, closes #1338, refs #1331 2021-05-23 18:41:50 -07:00
Simon Willison 9789b94da4 ?_facet_size=100 parameter, closes #1332 2021-05-22 17:34:33 -07:00
Simon Willison 0a7621f96f
Use pytest-xdist to speed up tests (#1290)
* Run tests in CI using pytest-xdist
* Documentation for pytest-xdist

Closes #1289
2021-04-02 20:42:28 -07:00
Simon Willison d579fcf4f7 Applied some fixes suggested by @withshubh in #1260 2021-03-28 17:20:55 -07:00
Simon Willison 6ad544df5e Fixed master -> main in a bunch of places, mainly docs 2021-03-23 09:19:41 -07:00
Konstantin Baikov 8e18c79431
Use context manager instead of plain open (#1211)
Context manager with open closes the files after usage.

When the object is already a pathlib.Path i used read_text
write_text functions

In some cases pathlib.Path.open were used in context manager,
it is basically the same as builtin open.

Thanks, Konstantin Baikov!
2021-03-11 08:15:49 -08:00
Simon Willison 7c87532acc New .add_memory_database() method, closes #1247 2021-02-28 20:02:18 -08:00
Simon Willison 47eb885cc2 JSON faceting now suggested even if column has blank strings, closes #1246 2021-02-28 19:44:04 -08:00
Simon Willison cc6774cbaa Upgrade httpx and remove xfail from tests, refs #1005 2021-02-28 14:34:44 -08:00
Simon Willison 726f781c50 Fix for arraycontains bug, closes #1239 2021-02-22 16:22:47 -08:00
Simon Willison 6f41c8a2be
--crossdb option for joining across databases (#1232)
* Test for cross-database join, refs #283
* Warn if --crossdb used with more than 10 DBs, refs #283
* latest.datasette.io demo of --crossdb joins, refs #283
* Show attached databases on /_memory page, refs #283
* Documentation for cross-database queries, refs #283
2021-02-18 14:09:12 -08:00
Simon Willison 36a44bffbf Validation for --port, closes #1226 2021-02-18 10:05:27 -08:00
Simon Willison 9603d893b9 Tests for --ssl-keyfile and --ssl-certfile, refs #1221 2021-02-11 16:53:20 -08:00
Simon Willison eda652cf6e
--ssl-keyfile and --ssl-certfile options to "datasette serve"
Closes #1221
2021-02-11 16:52:16 -08:00
Simon Willison 7a2ed9f8a1 Fixed bug with ?_sort= and ?_search=, closes #1214 2021-02-02 13:21:03 -08:00
Simon Willison 1600d2a3ec Renamed /:memory: to /_memory, with redirects - closes #1205 2021-01-28 14:48:56 -08:00
Simon Willison a5ede3cdd4 Fixed bug loading database called 'test-database (1).sqlite'
Closes #1181.

Also now ensures that database URLs have special characters URL-quoted.
2021-01-24 21:13:05 -08:00
Simon Willison 07e1635615 All ?_ parameters now copied to hidden form fields, closes #1194 2021-01-24 19:10:10 -08:00
Simon Willison c38c42948c extra_body_script module support, closes #1187 2021-01-13 18:14:33 -08:00
Simon Willison fa0c3777b8 script type=module support, closes #1186 2021-01-13 17:50:52 -08:00
Simon Willison 640ac7071b Better PRAGMA error message, closes #1185 2021-01-12 14:26:19 -08:00
Simon Willison 8e8fc5cee5 Applied Black 2021-01-11 13:34:38 -08:00
Simon Willison ef2ecc1b89 Standardize on 'query string', not 'querystring', in docs
The request property is request.query_string so this is more consistent.
2021-01-11 13:33:54 -08:00
Simon Willison 649f48cd70 request.full_path property, closes #1184 2021-01-11 13:32:58 -08:00
Simon Willison faa76390a0 Fixed bug introduced in e1efa9b7, refs #1178 2021-01-07 16:01:01 -08:00
Simon Willison 97fb10c17d Applied Black, refs #1178 2021-01-06 10:22:20 -08:00
Simon Willison e1efa9b7a3 force_https_urls on for publish cloudrun, refs #1178 2021-01-06 10:13:34 -08:00
Miroslav Šedivý a882d67962
Modernize code to Python 3.6+ (#1158)
* Compact dict and set building
* Remove redundant parentheses
* Simplify chained conditions
* Change method name to lowercase
* Use triple double quotes for docstrings

Thanks, @eumiro!
2020-12-23 09:04:32 -08:00
Simon Willison 8919f99c2f Improved .add_database() method design
Closes #1155 - _internal now has a sensible name

Closes #509 - Support opening multiple databases with the same stem
2020-12-22 12:04:18 -08:00
Simon Willison bc1f1e1ce8 Compound primary key for foreign_keys table in _internal 2020-12-22 11:04:29 -08:00
Simon Willison dcdfb2c301 Rename _schemas to _internal, closes #1156 2020-12-21 11:48:06 -08:00
Simon Willison ebc7aa287c In-memory _schemas database tracking schemas of attached tables, closes #1150 2020-12-18 14:34:05 -08:00
Simon Willison 5e9895c67f Database(memory_name=) for shared in-memory databases, closes #1151 2020-12-17 17:01:18 -08:00
Simon Willison 967cc05545 Powered by links to datasette.io, closes #1138 2020-12-10 15:37:08 -08:00
Simon Willison 2c0aca4887 _header=off option for CSV export, closes #1133 2020-12-10 15:28:44 -08:00
Simon Willison 6000d1a724 Fix for combining ?_search_x and ?_searchmode=raw, closes #1134 2020-12-09 11:56:44 -08:00
Simon Willison fe86d85308 datasette serve --create option, closes #1135 2020-12-09 11:45:45 -08:00
Simon Willison 4c25b035b2 arraynotcontains filter, closes #1132 2020-12-07 14:41:03 -08:00
Simon Willison eae103a82b Write errors to stderr, closes #1131 2020-12-04 21:21:11 -08:00
Simon Willison 42efb799ea Fixed invalid test for generated columns, refs #1119 2020-12-04 21:20:12 -08:00
Simon Willison 13c960c03b Test is no longer order dependent, closes #1123 2020-12-02 16:49:55 -08:00
Simon Willison a45a3dff3e Fix for OPTIONS request against /db, closes #1100 2020-12-02 16:49:55 -08:00
Simon Willison 88ac538b41 transfer-encoding: chunked for DB downloads, refs #749
This should get >32MB downloads working on Cloud Run.
2020-12-02 15:47:37 -08:00
Simon Willison 17cbbb1f7f
generated_columns table in fixtures.py, closes #1119 2020-11-30 16:28:02 -08:00
Simon Willison 461670a0b8
Support for generated columns
* Support for generated columns, closes #1116
* Show SQLite version in pytest report header
* Use table_info() if SQLite < 3.26.0
* Cache sqlite_version() rather than re-calculate every time
* Adjust test_database_page for SQLite 3.26.0 or higher
2020-11-30 13:29:57 -08:00
Simon Willison dea3c508b3 Revert "Support for generated columns, closes #1116" - it failed CI
This reverts commit 37f87b5e52.
2020-11-30 12:09:32 -08:00
Simon Willison 37f87b5e52 Support for generated columns, closes #1116 2020-11-30 12:01:15 -08:00
Simon Willison 4777362bf2 Work around CI bug with ensure_eventloop, refs #1115 2020-11-29 12:19:24 -08:00
Simon Willison 09033c08be Suggest --load-extension=spatialite, closes #1115 2020-11-29 12:13:16 -08:00
Simon Willison deb0be4ae5 Fix bug where compound foreign keys produced broken links, closes #1098 2020-11-29 11:30:17 -08:00
Simon Willison 37d18a5bce datasette publish cloudrun --apt-get-install, closes #1110 2020-11-24 19:05:35 -08:00
Simon Willison f2e2bfcdd9 Renamed datasette.config() to .setting(), closes #1107 2020-11-24 14:06:32 -08:00
Simon Willison 5a77f7a649 Updated docs renaming config to settings
- config.html is now settings.html
- ConfigOption in app.py is now Setting
- updated documentation unit tests

Refs #1106
2020-11-24 13:22:33 -08:00
Simon Willison 33eadb8782 config.json is now settings.json, closes #1104 2020-11-24 12:37:29 -08:00
Simon Willison 2a3d5b720b Redirect /-/config to /-/settings, closes #1103 2020-11-24 12:19:14 -08:00
Simon Willison 3159263f05 New --setting to replace --config, closes #992 2020-11-24 12:01:47 -08:00
Simon Willison 30e64c8d3b
Use f-strings in place of .format()
Code transformed like so:

    pip install flynt
    flynt .
    black .
2020-11-15 15:24:22 -08:00
Simon Willison e8e0a6f284
Use FTS4 in fixtures
Closes #1081
2020-11-11 16:02:58 -08:00
Simon Willison 2a981e2ac1 Blank foreign key labels now show as hyphens, closes #1086 2020-11-11 15:44:04 -08:00
Simon Willison 7b19492070 database_actions() plugin hook, closes #1077 2020-11-02 10:27:25 -08:00
Simon Willison 6bb41c4b33 Fix for test_paginate_using_link_header 2020-10-31 13:48:39 -07:00
Simon Willison a4ca26a265 Address PrefixedUrlString bug in #1075 2020-10-31 13:35:47 -07:00
Simon Willison bf18b9ba17 Stop using plugin-example.com, closes #1074 2020-10-31 12:47:42 -07:00
Simon Willison 84bc7244c1 datasette.client now applies base_url, closes #1026 2020-10-31 12:29:42 -07:00