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
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
ff29dd55fa
?_trace=1 now depends on trace_debug setting, closes #1359
2021-06-05 13:18:37 -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
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
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
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
cc6774cbaa
Upgrade httpx and remove xfail from tests, refs #1005
2021-02-28 14:34:44 -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
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
6000d1a724
Fix for combining ?_search_x and ?_searchmode=raw, closes #1134
2020-12-09 11:56:44 -08:00
Simon Willison
4c25b035b2
arraynotcontains filter, closes #1132
2020-12-07 14:41:03 -08:00
Simon Willison
42efb799ea
Fixed invalid test for generated columns, refs #1119
2020-12-04 21:20:12 -08:00
Simon Willison
a45a3dff3e
Fix for OPTIONS request against /db, closes #1100
2020-12-02 16:49:55 -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
deb0be4ae5
Fix bug where compound foreign keys produced broken links, closes #1098
2020-11-29 11:30:17 -08:00
Simon Willison
2a3d5b720b
Redirect /-/config to /-/settings, closes #1103
2020-11-24 12:19:14 -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
89519f9a37
Fixed bug with download of BLOB null, refs #1050
2020-10-28 21:05:40 -07:00
Simon Willison
cefd058c1c
New explicit versioning mechanism
...
Closes #1054
2020-10-28 20:38:15 -07:00
Simon Willison
c3aba4aa98
--cors for /name.db downloads, refs #1057
2020-10-27 13:39:57 -07:00
Simon Willison
e34e84901d
Link: HTTP header pagination, closes #1014
2020-10-10 17:18:45 -07:00
Simon Willison
8f97b9b58e
datasette.client internal requests mechanism
...
Closes #943
* Datasette now requires httpx>=0.15
* Support OPTIONS without 500, closes #1001
* Added internals tests for datasette.client methods
* Datasette's own test mechanism now uses httpx to simulate requests
* Tests simulate HTTP 1.1 now
* Added base_url in a bunch more places
* Mark some tests as xfail - will remove that when new httpx release ships: #1005
2020-10-09 09:11:24 -07:00
Simon Willison
a648bb82ba
Upgrade to Black 20.8b1, closes #958
2020-09-02 15:24:55 -07:00
Simon Willison
8e7e6458a6
Fix bug with ?_nl=on and binary data, closes #914
2020-08-16 11:26:49 -07:00
Simon Willison
563f5a2d3a
Magic parameters for canned queries
...
Closes #842
Includes a new plugin hook, register_magic_parameters()
2020-06-27 19:58:16 -07:00
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
Simon Willison
669fa21a71
Include request duration in traces
2019-05-01 16:27:14 -07:00
Simon Willison
e4e73a537a
Test for ?_trace=1, refs #435
2019-04-21 10:46:56 -07:00
Simon Willison
9c77e6e355
Support multiple filters of the same type
...
Closes #288
2019-04-15 16:44:17 -07:00
Simon Willison
bc6a9b4564
?_where= parameter on table views, closes #429
...
From pull request #430
2019-04-12 18:37:22 -07:00
Simon Willison
db74cf0144
?_fts_table= and ?_fts_pk= arguments, closes #428
2019-04-11 21:21:17 -07:00
Simon Willison
78e45ead4d
New ?tags__arraycontains=tag lookup against JSON fields
...
Part one of supporting facet-by-JSON-array, refs #359
2019-04-10 08:27:52 -07:00
Simon Willison
53bf875483
expand_foreign_keys() no longer uses inspect, refs #420
2019-04-06 19:56:07 -07:00
Simon Willison
7d0f668556
.resolve_db_name() and .execute() work without inspect
...
Refs #420
2019-03-31 16:51:52 -07:00
Simon Willison
6f6d0ff2b4
URL hashing is now off by default - closes #418
...
Prior to this commit Datasette would calculate the content hash of every
database and redirect to a URL containing that hash, like so:
https://v0-27.datasette.io/fixtures => https://v0-27.datasette.io/fixtures-dd88475
This assumed that all databases were opened in immutable mode and were not
expected to change.
This will be changing as a result of #419 - so this commit takes the first step
in implementing that change by changing this default behaviour. Datasette will
now only redirect hash-free URLs under two circumstances:
* The new `hash_urls` config option is set to true (it defaults to false).
* The user passes `?_hash=1` in the URL
2019-03-17 15:55:04 -07:00
Simon Willison
9743e1d91b
Support for :memory: databases
...
If you start Datasette with no files, it will connect to :memory: instead.
When starting it with files you can add --memory to also get a :memory: database.
2019-03-14 20:54:42 -07:00
Simon Willison
b5dd83981a
Export option: _shape=array&_nl=on for newline-delimited JSON
2019-01-27 17:40:23 -08:00