Simon Willison
a498d0fe65
Fix bug with over-riding default sort, closes #702
2020-03-21 19:40:29 -07:00
Simon Willison
236aa065b2
"sort" and "sort_desc" metadata properties, closes #702
2020-03-21 19:28:35 -07:00
Simon Willison
e1a817411a
Bump to click 7.1.1 to fix flaky tests
2020-03-21 18:47:51 -07:00
Simon Willison
2c0e1e09bc
Show sort arrow on primary key by default
...
Closes #677 . Refs #702 .
2020-03-21 16:57:37 -07:00
Simon Willison
a000c80d50
await Request(scope, receive).post_vars() method, closes #700
...
Needed for #698
2020-03-16 19:47:37 -07:00
Simon Willison
e1b5339fdf
Do not look for templates_path in default plugins
...
Closes #697
2020-03-08 16:11:18 -07:00
Simon Willison
ddd11b3ddd
--memory option for publish cloudrun, refs #694
2020-03-05 17:34:36 -06:00
Simon Willison
7f5a330377
Don't count rows on homepage for DBs > 100MB ( #688 )
...
Closes #649 .
2020-02-28 17:08:29 -08: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
a093c5f79f
.execute_write() and .execute_write_fn() methods on Database ( #683 )
...
Closes #682 .
2020-02-24 20:45:07 -08:00
Simon Willison
7c6a9c3529
Better tests for prepare_connection() plugin hook, refs #678
2020-02-21 18:27:07 -08:00
Simon Willison
d3f2fade88
Refactored run_sanity_checks to check_connection(conn), refs #674
2020-02-15 09:56:48 -08:00
Simon Willison
cf5f4386ef
Run black against everything, not just tests and datasette dirs
2020-02-13 15:02:10 -08:00
Jay Graves
33a12c8ae5
Allow leading comments in SQL input field ( #653 )
...
Thanks, @jaywgraves!
2020-02-04 18:13:24 -08:00
Simon Willison
67fc9c5720
--port argument for datasette package, plus tests - closes #661
...
From pull request #663
2020-01-29 14:46:43 -08:00
Katie McLaughlin
34d77d780f
gcloud run is now GA, s/beta// ( #660 )
...
Thanks, @glasnt
2020-01-21 15:28:11 -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
d3e1c3017e
Display 0 results, closes #637
2019-11-22 22:07:01 -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
Simon Willison
440a70428c
Include rowid in filter select, closes #636
2019-11-19 15:01:10 -08:00
Simon Willison
8c642f04e0
Render templates using Jinja async mode
...
Closes #628
2019-11-14 15:14:22 -08:00
Simon Willison
f524510230
Fix "publish heroku" + upgrade to use Python 3.8.0
...
Closes #633 . Closes #632 .
2019-11-13 08:42:47 -08:00
Simon Willison
d977fbadf7
datasette publish uses python:3.8 base Docker image, closes #629
2019-11-11 22:03:09 -08:00
Simon Willison
cf7776d36f
Support Python 3.8, stop supporting Python 3.5 ( #627 )
...
* Upgrade to uvicorn 0.10.4
* Drop support for Python 3.5
* Bump all dependencies to latest releases
* Update docs to reflect we no longer support 3.5
* Removed code that skipped black unit test on 3.5
Closes #622
2019-11-11 21:09:11 -08:00
Simon Willison
28c4a6db5b
CREATE INDEX statements on table page, closes #618
2019-11-09 17:29:36 -08:00
Simon Willison
83fc5165ac
Improved UI for publish cloudrun, closes #608
2019-11-07 18:48:39 -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
9db22cdf18
pk__notin= filter, closes #614
2019-11-03 20:11:55 -08:00
Simon Willison
2bf7ce5f51
Fix CSV export for nullable foreign keys, closes #612
2019-11-02 16:12:46 -07: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
7152e76eda
Don't suggest array facet if column is only [], closes #610
2019-11-01 14:45:59 -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
e2c390500e
Persist _where= in hidden fields, closes #604
2019-10-30 11:49:26 -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
b6ad1fdc70
Fixed bug returning non-ascii characters in CSV, closes #584
2019-10-17 22:23:01 -07:00
Simon Willison
3e864b1625
Use --platform=managed for publish cloudrun, closes #587
2019-10-17 14:51:45 -07:00
Tobias Kunze
12cec411ca
Display metadata footer on custom SQL queries ( #589 )
...
Closes #408 - thanks, @rixx!
2019-10-13 20:53:21 -07:00
Tobias Kunze
908fc3999e
Sort databases on homepage by argument order - #591
...
Closes #585 - thanks, @rixx!
2019-10-13 20:52:33 -07:00
Simon Willison
fffd69ec03
Allow EXPLAIN WITH... - closes #583
2019-10-06 10:23:58 -07:00
Simon Willison
2dc5c8dc25
detect_fts now works with alternative table escaping ( #571 )
...
Fixes #570 . See also https://github.com/simonw/sqlite-utils/pull/57
2019-09-02 17:32:27 -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
Abdus
74ecf8a7cc
Fix static mounts using relative paths and prevent traversal exploits ( #554 )
...
Thanks, @abdusco! Closes #555
2019-07-11 09:13:19 -07:00
Simon Willison
973f8f139d
--plugin-secret option for datasette publish
...
Closes #543
Also added new --show-files option to publish now and publish cloudrun - handy for debugging.
2019-07-07 19:06:31 -07:00
Simon Willison
c5542abba5
Removed ManyToManyFacet for the moment, closes #550
2019-07-07 16:21:11 -07:00
Simon Willison
fcfcae21e6
extra_template_vars plugin hook ( #542 )
...
* extra_template_vars plugin hook
Closes #541
* Workaround for cwd bug
Based on https://github.com/pytest-dev/pytest/issues/1235#issuecomment-175295691
2019-07-05 17:05:56 -07:00
Simon Willison
25ff0a8ba6
Fix for accidentally leaking secrets in /-/metadata, closes #538
2019-07-03 22:47:45 -07:00
Simon Willison
a2d4593193
Secret plugin configuration options ( #539 )
...
Closes #538
2019-07-03 22:36:44 -07:00
Simon Willison
4d2fdafe39
Added asgi_wrapper plugin hook, closes #520
2019-07-02 21:06:25 -07:00
Simon Willison
13e4f9a676
Unit test for _table custom template, refs #521
2019-07-02 20:23:05 -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
35429f9089
Revert "New encode/decode_path_component functions"
...
Refs #272
This reverts commit 9fdb47ca95
.
Now that ASGI supports raw_path we don't need our own encoding scheme!
2019-06-18 17:23:27 -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
de92c05134
Fixed duplicate function name
2019-05-27 18:49:57 -07:00
Simon Willison
839e55bf0a
Start of unit tests for Database class, refs #485
2019-05-27 18:42:30 -07:00
Simon Willison
182a3017c2
Sort keys to past tests in Python 3.5
2019-05-25 09:22:02 -07:00
Simon Willison
d923d84754
Facet by many-to-many, closes #365
2019-05-25 09:06:32 -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
2d14f21f85
Updated tests for date(...) lookup
2019-05-20 23:06:19 -07:00
Simon Willison
f4eefdf193
Do not allow downloads of mutable databases - closes #474
2019-05-19 13:41:09 -07:00
Simon Willison
7d8573d672
Rename "datasette publish now" to "datasette publish nowv1"
...
Also added an alias so "datasette publish now" continues to work.
Closes #472
2019-05-19 11:06:51 -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
21b57cdf9a
serve --inspect-file=X now populates cached table counts
...
Closes #462
2019-05-16 07:30:32 -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
79303163b2
Row count fix + sort index page databases alphabetically
...
Sorting alphabetically should fix a test failure in Python 3.5
Refs #460
2019-05-15 17:40:10 -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
e04511410f
Don't show hidden tables on index page, closes #455
...
Refs #460 . Also bulked out HTML index page unit tests.
2019-05-14 08:46:57 -07:00
Simon Willison
24bf79d2f0
Run sanity checks, not .inspect(), on startup
...
Also fixes tests that did NOT like a call to run_until_complete in the Datasette() constructor.
2019-05-11 16:22:55 -07:00
Simon Willison
da0b3ce2b7
New run_sanity_checks mechanism, for SpatiLite
...
Moved VirtualSpatialIndex check into a new mechanism that should allow
us to add further sanity checks in the future.
To test this I've had to commit a binary sample SpatiaLite database to
the repository. I included a build script for creating that database.
Closes #466
2019-05-11 15:55:30 -07:00
Simon Willison
c692cd2911
Fix test ordering
2019-05-11 15:03:52 -07:00
Simon Willison
a187c81e0c
Black + fix broken test
2019-05-11 14:45:59 -07:00
Simon Willison
c0d1b4c322
"datasette inspect foo.db" now just calculates table counts
...
Refs #462
* inspect command now just outputs table counts
* test_inspect.py is now only tests for that CLI command
* Updated some relevant documentation
* Removed docs for /-/inspect since that is about to change
2019-05-11 14:36:57 -07:00
Simon Willison
ce09e5d2d3
Fixed tests relating to #459
2019-05-11 13:58:22 -07:00
Simon Willison
05cabaebd9
Pass --token to now alias, refs #459
2019-05-11 13:35:34 -07:00
Simon Willison
09ef305c68
Fixed "datasette publish now ... --alias=x"
...
The --alias argument can now be passed more than once.
Also updated our Travis configuration to use this.
Fixes #459
2019-05-11 13:20:36 -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
2db977d8f3
tests/fixtures.py can now write out plugins too
...
This command:
python tests/fixtures.py \
fixtures.db \
metadata.json \
fixtures-plugins/
Will now create the fixtures.db and metadata.json files, AND create
a folder called fixtures-plugins/ containing two test plugins.
You can then run it like this:
datasette fixtures.db \
-m metadata.json --plugins-dir=fixtures-plugins/
2019-05-09 09:44:21 -07:00
Simon Willison
9fdb47ca95
New encode/decode_path_component functions
...
ASGI cannot differentiate between / and %2F in a URL, so we need an
alternative scheme for encoding the names of tables that contain special
characters such as /
For background, see
https://github.com/django/asgiref/issues/51#issuecomment-450603464
Some examples:
"table/and/slashes" => "tableU+002FandU+002Fslashes"
"~table" => "U+007Etable"
"+bobcats!" => "U+002Bbobcats!"
"U+007Etable" => "UU+002B007Etable"
2019-05-09 09:44:21 -07:00
Simon Willison
ec2db345e9
Fixed crash on /:memory: page
2019-05-05 14:01:14 -04: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
93c65d29ba
Fixed 500 error on /-/metadata page
2019-05-03 16:42:59 -04:00
Simon Willison
01b3de5b66
Unit test for binary data display, refs #442
2019-05-03 12:45:06 -04:00
Simon Willison
bade9daeb2
Docs for 'datasette publish cloudrun', refs #434
2019-05-03 12:16:58 -04:00
Romain Primet
75a21fc2a1
datasette publish cloudrun ( #434 ) - thanks, @rprimet
...
New publish subcommand that publishes using the
new Google Cloud Run platform.
datasette publish cloudrun database.db
2019-05-03 09:59:01 -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
ad9de774f7
Added missing file, refs #438
2019-05-01 22:10:23 -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