Commit graph

373 commits

Author SHA1 Message Date
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
e11cb4c664 Persist show/hide state better, closes #425 2019-04-11 22:00:47 -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
Simon Willison
53bf875483 expand_foreign_keys() no longer uses inspect, refs #420 2019-04-06 19:56:07 -07:00
Simon Willison
97331f3435 sortable_columns_for_table() no longer uses inspect()
Refs #420
2019-04-06 18:58:51 -07:00
Simon Willison
d8851e0011 Removed rogue print() 2019-04-06 18:54:51 -07:00
Simon Willison
468c6fd953 DatabaseDownload no longer uses .inspect(), refs #420 2019-03-31 19:04:17 -07:00
Simon Willison
29a3896fe1 .database_url(database) no longer needs inspect, refs #420 2019-03-31 16:55:38 -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
0209a0a344 table_exists() now uses async SQL, refs #420 2019-03-31 11:02:22 -07:00
Simon Willison
82fec60481 Fix for TypeError
File "../datasette/app.py", line 138, in __init__
      self.files = files + immutables
    TypeError: can only concatenate tuple (not "list") to tuple
2019-03-17 16:36:35 -07:00
Simon Willison
47032636b5 'datasette serve -i immutable.db' option, refs #419 2019-03-17 16:25:15 -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
afe9aa3ae0 show/hide link for SQL on custom query page
Closes #415
2019-03-14 22:22:35 -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
bf6b0f918d about and about_url metadata options 2019-03-14 20:54:42 -07:00
Simon Willison
4462a5ab28 Show size of database file next to download link, closes #172 2019-02-05 20:58:29 -08:00
Simon Willison
195a5b3634
Heroku --include-vcs-ignore (#407)
Means `datasette publish heroku` can work under Travis, unlike this failure:

https://travis-ci.org/simonw/fivethirtyeight-datasette/builds/488047550

```
2.25s$ datasette publish heroku fivethirtyeight.db -m metadata.json -n fivethirtyeight-datasette
tar: unrecognized option '--exclude-vcs-ignores'
Try 'tar --help' or 'tar --usage' for more information.
 ▸    Command failed: tar cz -C /tmp/tmpuaxm7i8f --exclude-vcs-ignores --exclude
 ▸    .git --exclude .gitmodules . >
 ▸    /tmp/f49440e0-1bf3-4d3f-9eb0-fbc2967d1fd4.tar.gz
 ▸    tar: unrecognized option '--exclude-vcs-ignores'
 ▸    Try 'tar --help' or 'tar --usage' for more information.
 ▸    
The command "datasette publish heroku fivethirtyeight.db -m metadata.json -n fivethirtyeight-datasette" exited with 0.
```

The fix for that issue is to call the heroku command like this:

    heroku builds:create -a app_name --include-vcs-ignore
2019-02-05 20:15:46 -08:00
Simon Willison
b5dd83981a Export option: _shape=array&_nl=on for newline-delimited JSON 2019-01-27 17:40:23 -08:00
Simon Willison
909cc8fbdf New 'datasette plugins' command to list installed plugins 2019-01-26 12:01:16 -08:00
Simon Willison
8ce7866312 compile_options output in /-/versions, closes #396 2019-01-10 16:44:50 -08:00
Simon Willison
996e8822d2 Fix CSV export hidden form fields, closes #393 2019-01-02 18:43:56 -08:00
Simon Willison
8b8ae55e7c Pass --token to 'now alias', if provided 2019-01-01 21:35:16 -08:00
Simon Willison
d95b46b09b datasette publish now --alias option
You can now use --alias to attempt to alias after you deploy.

Also updated now.json to use version: 1
2019-01-01 21:15:54 -08:00
Simon Willison
a2bfcfc1b1
Fix some regex DeprecationWarnings (#392) 2018-12-28 18:22:27 -08:00
Simon Willison
eac08f0dfc
--reload now also reloads if databases change on disk 2018-12-20 07:51:08 -08:00
Simon Willison
54a59b9fdb
Use python-3.6.7 runtime for Heroku deploys 2018-12-16 12:53:00 -08:00
Simon Willison
b6546da535
Use Zeit cloud v1 to avoid 100MB image limit
Closes #366 - thanks @slygent
2018-11-04 22:22:34 -08:00
Simon Willison
b7c6a9f9bd
extra_css_urls(template, database, table, datasette)
The extra_css_urls and extra_js_urls hooks now take additional optional
parameters.

Also refactored them out of the Datasette class and into RenderMixin.

Plus improved plugin documentation to explicitly list parameters.
2018-08-28 11:56:57 +01:00
Simon Willison
fbf446965b
Refactoring: renamed "name" variable to "database" 2018-08-28 11:25:13 +01:00
Simon Willison
2e836f72d9
render_cell(value, column, table, database, datasette)
The render_cell plugin hook previously was only passed value.

It is now passed (value, column, table, database, datasette).
2018-08-28 03:03:01 -07:00
Simon Willison
5cf0c6c91c
New plugin hook: extra_body_script 2018-08-28 02:02:49 -07:00
Simon Willison
0a14a4846b
Added plugin_config() method 2018-08-28 01:35:21 -07:00
Simon Willison
1905c03364
New ds.metadata() method 2018-08-28 00:45:39 -07:00
Simon Willison
0bd41d4cb0
Do not show default plugins on /-/plugins 2018-08-28 00:36:22 -07:00
Simon Willison
aae49fef3b
Import pysqlite3 if available, closes #360 (#361) 2018-08-15 17:58:56 -07:00
Simon Willison
2189be1440
Refactor to use new datasatte.config(key) method 2018-08-11 13:09:07 -07:00
Simon Willison
fe5b6ea95a
Hide 'view and edit SQL' if config.allow_sql turned off 2018-08-05 20:17:17 -07:00
Simon Willison
7d0299edd4
fts_table and fts_pk metadata configs, available for both tables and views 2018-08-05 17:44:47 -07:00
Simon Willison
5629aaca67
sortable_columns also now works with views 2018-08-05 17:29:23 -07:00
Simon Willison
4ac9132240
render_cell(value) plugin hook, closes #352
New plugin hook for customizing the way cells values are rendered in HTML.

The first full example of this hook in use is https://github.com/simonw/datasette-json-html
2018-08-04 17:14:56 -07:00
Simon Willison
1fb518618c
"datasette publish heroku" improvements
* Fixed bug where --title= didn't work if -m not provided
* Now using Python 3.6.6 instead of Python 3.6.3
2018-07-25 22:43:01 -07:00
Simon Willison
dbbe707841
publish_subcommand hook + default plugins mechanism, used for publish heroku/now (#349)
This change introduces a new plugin hook, publish_subcommand, which can be
used to implement new subcommands for the "datasette publish" command family.

I've used this new hook to refactor out the "publish now" and "publish heroku"
implementations into separate modules. I've also added unit tests for these
two publishers, mocking the subprocess.call and subprocess.check_output
functions.

As part of this, I introduced a mechanism for loading default plugins. These
are defined in the new "default_plugins" list inside datasette/app.py

Closes #217 (Plugin support for datasette publish)
Closes #348 (Unit tests for "datasette publish")
Refs #14, #59, #102, #103, #146, #236, #347
2018-07-25 22:15:59 -07:00