Wykres commitów

97 Commity (6d7cb02f00010d3cb4b4bac0460d41277652b80e)

Autor SHA1 Wiadomość Data
Simon Willison 5ea8c6d1cd type-pk instead of type-link CSS class, closes #729 2020-05-14 22:55:20 -07:00
Simon Willison 504196341c Visually distinguish float/int columns, closes #729 2020-05-14 22:51:39 -07:00
Simon Willison 4433306c18
Improvements + docs for db.execute() and Results class
* Including new results.first() and results.single_value() methods. Closes #685
2020-05-08 09:05:46 -07:00
Simon Willison 07e208cc6d Refactored .custom_sql() method to new QueryView class
Refs #698
2020-04-02 18:12:13 -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
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 2c0e1e09bc Show sort arrow on primary key by default
Closes #677. Refs #702.
2020-03-21 16:57:37 -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 f1442a8151 Replaced self.ds.execute with db.execute in more places 2020-02-13 18:20:05 -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 440a70428c Include rowid in filter select, closes #636 2019-11-19 15:01:10 -08:00
Simon Willison f9c146b893 Removed unused special_args_lists variable 2019-11-06 16:55:44 -08:00
Simon Willison c30f07c58e Removed _group_count=col feature, closes #504 2019-11-05 21:12:55 -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 3ca290e0db Fixed dumb error 2019-10-30 12:00:21 -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
Simon Willison e7120d91f6 Rename _rows_and_columns.html to _table.html, refs #521 2019-07-02 20:23:05 -07:00
Simon Willison c461357b44 Default to raw value, use Row.display(key) for display, refs #521 2019-07-02 20:23:05 -07:00
Simon Willison 754836eef0 New experimental Row() for templates, 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 d4df640d18 Refactored view class hierarchy, refs #272
See https://github.com/simonw/datasette/issues/272#issuecomment-502393107
2019-06-15 12:41:34 -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 bd4dbc8519 Rename InterruptedError => QueryInterrupted, closes #490 2019-05-27 17:16:36 -07:00
Simon Willison edb36629e7 Database.get_outbound_foreign_keys() refactor
Following this, the only module that ever makes calls to the low-level
execute_against_connection_in_thread() method is datasette/database.py
2019-05-27 11:41:44 -07:00
Simon Willison 20f98c3e20 Databse.primary_keys(table) / fts_table(table) refactor, closes #488
Also cleaned up some unused imports spotted by the linter.
2019-05-27 11:27:42 -07:00
Simon Willison 026c84db30 Refactor Datasette methods to ConnectedDatabase
Refs #487
2019-05-26 21:56:43 -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 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
Russ Garrett d555baf508 Suppress rendering of binary data - thanks @russss (#442)
Binary columns (including spatialite geographies) get shown as ugly
binary strings in the HTML by default. Nobody wants to see that mess.

Show the size of the column in bytes instead. If you want to decode
the binary data, you can use a plugin to do it.
2019-05-03 12:44:48 -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
Russ Garrett cf406c0754 New plugin hook: register_output_renderer hook (#441)
Thanks @russss!

* Add register_output_renderer hook

This changeset refactors out the JSON renderer and then adds a hook and
dispatcher system to allow custom output renderers to be registered.

The CSV output renderer is untouched because supporting streaming
renderers through this system would be significantly more complex, and
probably not worthwhile.

We can't simply allow hooks to be called at request time because we need
a list of supported file extensions when the request is being routed in
order to resolve ambiguous database/table names. So, renderers need to
be registered at startup.

I've tried to make this API independent of Sanic's request/response
objects so that this can remain stable during the switch to ASGI. I'm
using dictionaries to keep it simple and to make adding additional
options in the future easy.

Fixes #440
2019-05-01 16:01: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 6da567dda9 Extract and refactor filters into filters.py
This will help in implementing __in as a filter, refs #433
2019-04-15 14:51:20 -07:00
Simon Willison d1075b8259 Cleaned up pylint warnings 2019-04-13 12:20:10 -07:00
Simon Willison 13ee3c222f Moved BaseView.absolute_url() to Datasette 2019-04-13 12:16:05 -07:00
Simon Willison 274ef43bb7 Moved expand_foreign_keys() from TableView to Datasette 2019-04-13 11:48:00 -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 3a208a41d4 TableView.data() no longer uses .inspect, refs #420
BUT... it does a count(*) against the whole table which may take unbounded time.

Fixing this is part of #422
2019-04-06 20:47:10 -07:00
Simon Willison 36bd6558b0 expandable_columns() no longer uses inspect, refs #420 2019-04-06 20:46:08 -07:00
Simon Willison db02311ebf foreign_key_tables no longer uses inspect, refs #420 2019-04-06 20:23:30 -07:00
Simon Willison f23120a964 RowView.data() no longer uses inspect refs #420 2019-04-06 20:17:47 -07:00
Simon Willison c882e9262f display_columns_and_rows() no longer uses inspect, refs #420 2019-04-06 20:11:08 -07:00