Commit graph

237 commits

Author SHA1 Message Date
Simon Willison
a4ad5a504c Workaround for 'Too many open files' in test runs, refs #846 2020-06-13 17:26:18 -07:00
Simon Willison
49d6d2f7b0 allow_sql block to control execute-sql upermission in metadata.json, closes #813
Also removed the --config allow_sql:0 mechanism in favour of the new allow_sql block.
2020-06-08 17:05:44 -07:00
Simon Willison
2a8b39800f Updated tests, refs #811 2020-06-08 07:50:06 -07:00
Simon Willison
abc7339124 Nicer pattern for make_app_client() in tests, closes #395 2020-06-07 14:14:10 -07:00
Simon Willison
86dec9e8ff Added permission check to every view, closes #808 2020-06-06 22:30:36 -07:00
Simon Willison
75c143a84c Fixed /-/plugins?all=1, refs #802 2020-06-05 16:55:08 -07:00
Simon Willison
f786033a5f Fixed 'datasette plugins' command, with tests - closes #802 2020-06-05 16:46:37 -07:00
Simon Willison
a7137dfe06 /-/plugins now shows details of hooks, closes #794
Also added /-/plugins?all=1 parameter to see default plugins.
2020-06-02 14:49:28 -07:00
Simon Willison
5278c04682 More consistent use of response.text/response.json in tests, closes #792 2020-06-02 14:29:12 -07:00
Simon Willison
4fa7cf6853 Flash messages mechanism, closes #790 2020-06-02 14:12:18 -07:00
Simon Willison
7bb30c1f11 request.url now respects force_https_urls, closes #781 2020-05-28 10:10:06 -07:00
Simon Willison
75cd432e5a Ability to set custom table/view page size in metadata, closes #751 2020-05-27 22:00:04 -07:00
Simon Willison
52c4387c7d Redesigned register_output_renderer plugin hook, closes #581 2020-05-27 19:21:41 -07:00
Simon Willison
446e5de65d Refactored test plugins into tests/plugins, closes #775 2020-05-27 17:57:25 -07:00
Simon Willison
7656fd64d8
base_url configuration setting, closes #394
* base_url configuration setting
* base_url works for static assets as well
2020-03-24 17:18:43 -07:00
Kevin Keogh
3041c6b641
Use inspect-file, if possible, for total row count (#666)
For large tables, counting the number of rows in the table can take a
significant amount of time. Instead, where an inspect-file is provided
for an immutable database, look up the row-count for a plain count(*).

Thanks, @kevindkeogh
2020-02-25 12:19:29 -08:00
Simon Willison
6cb65555f4
?_searchmode=raw option (#686) 2020-02-24 21:56:03 -08:00
Simon Willison
3c861f363d _search= queries now correctly escaped, fixes #651
Queries with reserved words or characters according to the SQLite
FTS5 query language could cause errors.

Queries are now escaped like so:

    dog cat => "dog" "cat"
2019-12-29 18:48:30 +00:00
Simon Willison
d54318fc7f Added template_debug setting, closes #654 2019-12-22 16:04:45 +00:00
Simon Willison
d6b6c9171f Include asyncio task information in /-/threads debug page 2019-12-04 22:47:17 -08:00
Simon Willison
fd137da7f8 Suggest column facet only if at least one count > 1
Fixes #638
2019-11-21 16:56:55 -08:00
Tobias Kunze
931bfc6661 Handle spaces in DB names (#590)
Closes #503 - thanks, @rixx
2019-11-04 15:16:30 -08:00
Simon Willison
52fa79c607 Use select colnames, not select * for table view - refs #615 2019-11-04 15:03:48 -08:00
Simon Willison
14da70525b Don't show 'None' as label for nullable foreign key, closes #406 2019-11-02 15:29:40 -07:00
Simon Willison
50287e7c6b Only suggest array facet for arrays of strings - closes #562 2019-11-01 12:37:46 -07:00
Simon Willison
5dd4d2b2d3
Update to latest black (#609) 2019-10-30 11:49:01 -07:00
chris48s
f4c0830529 Always pop as_format off args dict (#603)
Closes #563. Thanks, @chris48s
2019-10-20 19:03:08 -07:00
Simon Willison
b647b5efc2
Fix for /foo v.s. /foo-bar issue, closes #597
Pull request #599
2019-10-18 15:51:07 -07:00
Simon Willison
90d4f497f9 Fix plus test for unicode characters in custom query name, closes #558 2019-07-13 19:49:24 -07:00
Simon Willison
ba8db9679f
Port Datasette from Sanic to ASGI + Uvicorn (#518)
Datasette now uses ASGI internally, and no longer depends on Sanic.

It now uses Uvicorn as the underlying HTTP server.

This was thirteen months in the making... for full details see the issue:

https://github.com/simonw/datasette/issues/272

And for a full sequence of commits plus commentary, see the pull request:

https://github.com/simonw/datasette/pull/518
2019-06-23 20:13:09 -07:00
Simon Willison
2a4b892d6c Tidy up with Black 2019-05-27 19:28:47 -07:00
Simon Willison
9c58d048ec Fix pagination when sorted by expanded foreign key
Closes #489
2019-05-27 19:23:18 -07:00
Simon Willison
172da009d8 Added ?_through= table argument, closes #355
Also added much more interesting many-to-many fixtures - roadside attractions!
2019-05-22 22:45:12 -07:00
Simon Willison
967230c90e Facet by date, closes #481 2019-05-20 23:09:22 -07:00
Simon Willison
db9dbfb816 ?_hash=1 no longer respected for mutable databases
Closes #471, refs #419
2019-05-16 08:10:25 -07:00
Simon Willison
0dad111d24 New introspection endpoint: /-/databases - closes #470
Refs #419 and #465
2019-05-16 07:49:34 -07:00
Simon Willison
909e66dfdb Removed .inspect() and /-/inspect.json
Refs #462

/-/inspect.json may return in some shape in #465
2019-05-16 07:15:24 -07:00
Simon Willison
faf33515b2 Sometimes sort tables by number of relationships, closes #460 2019-05-15 20:23:33 -07:00
Simon Willison
689cf9c139 Index page only shows row counts for smaller databases
The index page now only shows row counts for immutable databases OR for
databases with less than 30 tables provided it could get a count for
each of those tables in less than 10ms.

Closes #467, Refs #460
2019-05-15 20:02:33 -07:00
Simon Willison
5d6b2c30f1 Include views on homepage, fix table counts
If we have less than 5 tables we now also show one or more views in the
summary on the homepage.

Also corrected the logic for the row counts - we now count hidden and
visible tables separately.

Closes #373, Refs #460
2019-05-15 17:28:07 -07:00
Simon Willison
a0d444837f Finished implementation of ?_trace=1 debug tool
I redesigned the JSON output and added a handy "traceback" key showing
three relevant lines of the current traceback for each logged query.

Closes #435
2019-05-11 12:06:22 -07:00
Simon Willison
831515b834 Respect --cors for error pages, closes #453 2019-05-05 08:12:03 -04:00
Simon Willison
35d6ee2790
Apply black to everything, enforce via unit tests (#449)
I've run the black code formatting tool against everything:

    black tests datasette setup.py

I also added a new unit test, in tests/test_black.py, which will fail if the code does not
conform to black's exacting standards.

This unit test only runs on Python 3.6 or higher, because black itself doesn't run on 3.5.
2019-05-03 22:15:14 -04:00
Simon Willison
01b3de5b66 Unit test for binary data display, refs #442 2019-05-03 12:45:06 -04:00
Simon Willison
53d2f00b73 Implemented ArrayFacet, closes #359 2019-05-02 20:21:27 -04:00
Simon Willison
ea66c45df9
Extract facet code out into a new plugin hook, closes #427 (#445)
Datasette previously only supported one type of faceting: exact column value counting.

With this change, faceting logic is extracted out into one or more separate classes which can implement other patterns of faceting - this is discussed in #427, but potential upcoming facet types include facet-by-date, facet-by-JSON-array, facet-by-many-2-many and more.

A new plugin hook, register_facet_classes, can be used by plugins to add in additional facet classes.

Each class must implement two methods: suggest(), which scans columns in the table to decide if they might be worth suggesting for faceting, and facet_results(), which executes the facet operation and returns results ready to be displayed in the UI.
2019-05-02 17:11:26 -07:00
Simon Willison
efc93b8ab5 Entirely removed table_rows_count table property
We were not displaying this anywhere, and it is now expensive to calculate.

Refs #419, #420
2019-05-01 22:29:47 -07:00
Simon Willison
f553a67021 Don't load setuptools plugins during test runs
Uses pattern from https://docs.pytest.org/en/latest/example/simple.html#detect-if-running-from-within-a-pytest-run

Closes #438
2019-05-01 22:09:03 -07:00
Simon Willison
50d2d1aac9 Fixed bug where metadata.json hidden tables were ignored 2019-05-01 17:54:48 -07:00
Simon Willison
e7151ccccf Index page no longer uses inspect data - refs #420
Also introduced a mechanism whereby table counts are calculated against a time limit
but immutable databases have their table counts calculated on server startup.
2019-05-01 17:39:39 -07:00