Simon Willison
c857608738
Merge "Support filtering with units" from #205
2018-04-14 08:17:09 -07:00
Simon Willison
dd4491dd81
Update number of expected tables
2018-04-14 08:16:54 -07:00
Simon Willison
6b15a53cd3
Unit test for unlabelled foreign keys from #207
2018-04-14 08:00:54 -07:00
Russ Garrett
f2b940d602
Link foreign keys which don't have labels
...
This renders unlabeled FKs as simple links. I can't see why this would
cause any major problems.
Also includes bonus fixes for two minor issues:
* In foreign key link hrefs the primary key was escaped using HTML
escaping rather than URL escaping. This broke some non-integer PKs.
* Print tracebacks to console when handling 500 errors.
2018-04-14 07:59:59 -07:00
Simon Willison
d72201e883
Added unit test for foreign key links in HTML
...
Needed to add a further unit test for #207
2018-04-14 07:55:27 -07:00
Russ Garrett
1cc5161089
Fix sqlite error when loading rows with no incoming FKs
...
This fixes `ERROR: conn=<sqlite3.Connection object at 0x10bbb9f10>, sql
= 'select ', params = {'id': '1'}` caused by an invalid query when
loading incoming FKs.
The error was ignored due to async but it still got printed to the
console.
2018-04-14 07:24:24 -07:00
Russ Garrett
7d5f25dfb3
Add link to pint custom units page to docs
2018-04-14 15:08:20 +01:00
Russ Garrett
ed974417ad
Tests for unit filtering
2018-04-14 15:06:52 +01:00
Russ Garrett
3c985ec271
Allow custom units to be registered with Pint
2018-04-14 12:27:06 +01:00
Russ Garrett
ab85605c61
Support units in filters
2018-04-14 11:43:35 +01:00
Russ Garrett
8bfeb98478
Tidy up units support
...
* Add units to exported JSON
* Units key in metadata skeleton
* Docs
2018-04-14 11:43:34 +01:00
Russ Garrett
ec6abc81e4
Initial units support
...
Add support for specifying units for a column in metadata.json and
rendering them on display using
[pint](https://pint.readthedocs.io/en/latest/ ).
ref #203
2018-04-13 20:32:53 -07:00
Simon Willison
fb988ace7c
Release 0.17 to fix issues with PyPI
...
See https://twitter.com/simonw/status/984862976447414272
2018-04-13 12:04:40 -07:00
Simon Willison
b6539ff045
Releasing v0.16
2018-04-13 11:28:55 -07:00
Simon Willison
6e16ed2a63
Removed pathlib dependency (incompatible with Python 3.5)
2018-04-13 11:22:15 -07:00
Simon Willison
9f28bbe43d
Better mechanism for handling errors; 404s for missing table/database
...
New error mechanism closes #193
404s for missing tables/databesse closes #184
Makes pull request #202 unnecessary.
2018-04-13 11:17:22 -07:00
Simon Willison
ad6142b67c
long_description in markdown for the new PyPI
2018-04-13 09:04:18 -07:00
Russ Garrett
d08a133140
Hide Spatialite system tables
...
They were getting on my nerves.
2018-04-12 14:34:47 -07:00
Simon Willison
cca8bf36fe
Allow explain select / explain query plan select
...
Closes #201
2018-04-12 14:32:47 -07:00
Simon Willison
bfb4e45a7b
Datasette Publish in readme
2018-04-11 07:43:28 -07:00
Simon Willison
46b237c29a
datasette inspect now finds primary_keys
...
Closes #195
2018-04-09 17:54:12 -07:00
Simon Willison
57b19f09d1
Ability to sort using form fields (for mobile portrait mode)
...
We now display sort options as a select box plus a descending checkbox, which
means you can apply sort orders even in portrait mode on a mobile phone where
the column headers are hidden.
Closes #199
2018-04-09 17:34:32 -07:00
Simon Willison
67982b6ecb
Added Datasette 0.15 to news
2018-04-09 09:01:03 -07:00
Simon Willison
7706fe0c67
Releasing v0.15
2018-04-09 08:48:24 -07:00
Simon Willison
a290f28caa
table_rows => table_rows_count, filtered_table_rows => filtered_table_rows_count
...
Renamed properties. Closes #194
2018-04-08 22:24:24 -07:00
Simon Willison
c1d37fdf2b
Fixed bug with human filter description, refs #189
...
We were showing this:
201 rows where sorted by sortable_with_nulls
We now show this:
201 rows sorted by sortable_with_nulls
2018-04-08 22:10:22 -07:00
Simon Willison
23e0fdb0f3
Removed unnecessary enumerate template helper
...
I made this obsolete in d1756d7736
Refs #189
2018-04-08 22:10:22 -07:00
Simon Willison
b13f0986f2
New sortable_columns option in metadata.json to control sort options
...
You can now explicitly set which columns in a table can be used for sorting
using the _sort and _sort_desc arguments using metadata.json:
{
"databases": {
"database1": {
"tables": {
"example_table": {
"sortable_columns": [
"height",
"weight"
]
}
}
}
}
}
Refs #189
2018-04-08 22:10:22 -07:00
Simon Willison
a87df963a0
Error handling for ?_sort and ?_sort_desc
...
Verifies that they match an existing column, and only one or the other option
is provided - refs #189
Eses a new DatasetteError exception that closes #193
2018-04-08 22:10:22 -07:00
Simon Willison
bfb19e3a17
Correctly escape sort-by columns in SQL (refs #189 )
2018-04-08 22:10:22 -07:00
Simon Willison
747a801b50
Column headers now link to sort/desc sort - refs #189
2018-04-08 22:10:22 -07:00
Simon Willison
9f2ec39fbc
Current sort order now reflected in human filter description
...
Plus renamed human_description to human_description_en
Refs #189
2018-04-08 22:10:22 -07:00
Simon Willison
f3a3820ff5
_sort and _sort_desc parameters for table views
...
Allows for paginated sorted results based on a specified column.
Refs #189
2018-04-08 22:10:22 -07:00
Simon Willison
29f9a29250
Total row count now correct even if _next= applied
2018-04-08 22:10:22 -07:00
Simon Willison
b2188f0442
Use .custom_sql() for _group_count implementation (refs #150 )
2018-04-08 08:43:45 -07:00
Ryan Pitts
446d47fdb0
make html title more readable in query template ( #180 )
...
tiny tweak to make this easier to visually parse—I think it matches your style in other templates
2018-04-03 08:24:04 -07:00
Simon Willison
0abd3abacb
New ?_shape=objects/object/lists param for JSON API ( #192 )
...
New _shape= parameter replacing old .jsono extension
Now instead of this:
/database/table.jsono
We use the _shape parameter like this:
/database/table.json?_shape=objects
Also introduced a new _shape called 'object' which looks like this:
/database/table.json?_shape=object
Returning an object for the rows key:
...
"rows": {
"pk1": {
...
},
"pk2": {
...
}
}
Refs #122
2018-04-03 07:52:54 -07:00
Simon Willison
dd0566ff8e
Utility for writing test database fixtures to a .db file
...
python tests/fixtures.py /tmp/hello.db
This is useful for making a SQLite database of the test fixtures for
interactive exploration.
2018-04-03 06:46:11 -07:00
Simon Willison
8f0d44d646
escape_sqlite_table_name => escape_sqlite, handles reserved words
...
It can be used for column names as well as table names.
Reserved word list from https://www.sqlite.org/lang_keywords.html
2018-04-03 06:40:49 -07:00
Simon Willison
0e5f51adfe
Three more news items
2018-03-30 00:03:45 -07:00
Simon Willison
7365c3f51c
Compound primary key _next= now plays well with extra filters
...
Closes #190
2018-03-29 23:26:22 -07:00
Simon Willison
31f63d1672
Fixed bug with keyset pagination over compound primary keys
...
Closes #190
2018-03-29 22:11:02 -07:00
Simon Willison
89d9fbb91b
Database/Table views inherit source/license/source_url/license_url metadata
...
If you set the source_url/license_url/source/license fields in your root
metadata those values will now be inherited all the way down to the database
and table templates.
The title/description are NOT inherited.
Also added unit tests for the HTML generated by the metadata.
Refs #185
2018-03-27 09:18:32 -07:00
Simon Willison
012fc7c5cd
Fix for FTS virtual table counting error
2018-03-20 18:26:04 -07:00
Simon Willison
56623e48da
News: Datasette Publish
2018-01-17 07:50:10 -08:00
Tony Hirst
3a56a2cd7e
Add metadata, if it exists, to heroku temp dir ( #178 )
2018-01-14 13:05:16 -08:00
Simon Willison
cac32b0ec4
Initial documentation for pagination
2018-01-09 20:47:03 -08:00
Simon Willison
e63f432fe5
Mention Heroku in docs index page
2018-01-09 20:46:34 -08:00
Simon Willison
306e1c6ac4
Broke up test_app into test_api and test_html
2017-12-15 04:08:24 -08:00
Simon Willison
1aad396c9e
Fixed bug with .json path regular expression
...
I had a table called "geojson" and it caused an exception because the regex
was matching .json and not \.json
2017-12-12 21:36:03 -08:00