Wykres commitów

254 Commity (in-memory-option)

Autor SHA1 Wiadomość Data
Simon Willison b053fa4a5d
WIP: --memory option for loading entire database into :memory: 2018-01-09 20:45:11 -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
Simon Willison 4f08fc092f
Updated news 2017-12-12 08:52:19 -08:00
Simon Willison 702829f808
Added Datasette 0.14: customization edition to news 2017-12-09 18:10:30 -08:00
Simon Willison 68a34bc222
Deploy to Heroku with Python 3.6.3
Heroku deploys are currently showing the following warning:

    The latest version of Python 3 is python-3.6.3 (you are using python-3.6.2, which is unsupported).
    We recommend upgrading by specifying the latest version (python-3.6.3).
2017-12-09 18:01:17 -08:00
Simon Willison 2edc652df6
Releasing v0.14 2017-12-09 17:33:24 -08:00
Simon Willison ae94006809
No longer include database hash in hyperlinks
It was making the unit tests unreliable. Also we do not do that for foreign key links.
2017-12-09 17:31:08 -08:00
Simon Willison 7db790fbf9
Release notes for 0.14
Also updated "datasette serve" help in getting started docs.
2017-12-09 17:26:32 -08:00
Simon Willison 794c3bfcfc
Cleaned up row/column display logic, fixed bug
Closes #167
2017-12-09 16:59:25 -08:00
Simon Willison 7a7e4b2ed8
Started unit tests for row/table HTML pages
Refs #167

Thanks to the new tests, spotted and fixed a bug where pages that were
supposed to have 100 things on them were actually displaying 101.
2017-12-09 15:32:54 -08:00
Simon Willison 3f2fed1093
Fixed bug with HTML labels
loop.counter is incorrect - loop.index outputs the correct loop value.
2017-12-09 13:57:36 -08:00
Simon Willison 7126d08f10
HTML comment showing which templates were considered for a page
Closes #171
2017-12-09 13:47:32 -08:00
Simon Willison 3c9f889715
Custom templates for canned queries
Closes #170
2017-12-09 13:34:46 -08:00
Simon Willison 6bdfcf6076
Added Heroku to README, updated --help output examples
Refs #157
2017-12-09 10:50:08 -08:00
Simon Willison 06645f2e26
Formatting tweak 2017-12-09 10:41:20 -08:00
Simon Willison 1c0d93c39b
Fix Python 3.5 test failure 2017-12-09 10:39:19 -08:00
Simon Willison b01304d707
Updated tests I broke in c195ee4 2017-12-09 10:39:19 -08:00
Simon Willison 3459ab9166
Formatting fixes 2017-12-09 10:33:14 -08:00
Simon Willison c195ee4d46
package and publish commands now accept --static and --template-dir
Example usage:

    datasette package --static css:extra-css/ --static js:extra-js/ \
    	sf-trees.db --template-dir templates/ --tag sf-trees --branch master

This creates a local Docker image that includes copies of the templates/,
extra-css/ and extra-js/ directories. You can then run it like this:

	docker run -p 8001:8001 sf-trees

For publishing to Zeit now:

	datasette publish now --static css:extra-css/ --static js:extra-js/ \
		sf-trees.db --template-dir templates/ --name sf-trees --branch master

Example: https://sf-trees-wbihszoazc.now.sh/sf-trees-02c8ef1/Street_Tree_List

For publishing to Heroku:

	datasette publish heroku --static css:extra-css/ --static js:extra-js/ \
		sf-trees.db --template-dir templates/ --branch master

Closes #157, #160
2017-12-09 10:28:49 -08:00
Simon Willison 2cc14a236c
Ditched short form options for --static and --template-dir
The -t clashes with the package --tag option
2017-12-08 19:47:50 -08:00
Simon Willison 16dfccb1c5
Include sha1 hash in /static/app.css URL
This means that when Datasette's CSS changes the new CSS will be loaded
even though browsers may have cached the previous version.

Closes #154
2017-12-08 19:10:09 -08:00
Simon Willison 446f4b8322
Upgrade to Sanic 0.7.0 (#168)
https://github.com/channelcat/sanic/releases/tag/0.7.0
2017-12-08 19:00:33 -08:00
Simon Willison 61e3c5a1e9
Removed rogue print statement, refs #141 2017-12-08 08:08:00 -08:00
Simon Willison cbfd6b745e
Publish should now work if /tmp is on different device
Fixes #141
2017-12-08 08:06:24 -08:00
Simon Willison 9af2964f6f
Documentation for metadata.json and "datasette skeleton" command
http://datasette.readthedocs.io/en/latest/metadata.html

Closes #166
2017-12-07 09:19:35 -08:00
Simon Willison 0539905806
Renamed "datasette build" command to "datasette inspect"
Closes #130
2017-12-07 08:57:31 -08:00
Simon Willison 80bf3afa43
metadata.json support for per-table/per-database metadata
Also added support for descriptions and HTML descriptions.

Here's an example metadata.json file illustrating custom per-database and per-
table metadata:

    {
        "title": "Overall datasette title",
        "description_html": "This is a <em>description with HTML</em>.",
        "databases": {
            "db1": {
                "title": "First database",
                "description": "This is a string description & has no HTML",
                "license_url": "http://example.com/",
        		"license": "The example license",
                "queries": {
                	"canned_query": "select * from table1 limit 3;"
                },
                "tables": {
                    "table1": {
                        "title": "Custom title for table1",
                        "description": "Tables can have descriptions too",
                        "source": "This has a custom source",
                        "source_url": "http://example.com/"
                    }
                }
            }
        }
    }

Closes #165, Refs #164
2017-12-07 08:47:07 -08:00
Simon Willison 515eaa8ccb
--reload now reloads on metadata changes too 2017-12-07 08:42:28 -08:00
Simon Willison 32cf5a4a72
New datasette skeleton command for generating metadata.json
Closes #164
2017-12-06 22:20:37 -08:00
Simon Willison 7e1ba161ec
Ability to easily customize _rows_and_columns.html per database table
Also added documentation for this.

Refs #158, Closes #159.
2017-12-06 22:11:22 -08:00
Simon Willison afbda9e210
All extra_head blocks now call super
This means you can provide a custom base.html template that populates
extra_head and any of the default child templates will still render content
you included in that block.

Refs #158
2017-12-06 21:58:42 -08:00
Simon Willison a2b954e828
Fixed #155 2017-12-06 21:39:47 -08:00
Simon Willison 198b8b2955
Fixed row page for tables with a primary key
Closes #152
2017-12-06 21:23:13 -08:00
Simon Willison 52a5e95d21
Fixed bug with filter columns
Closes #162
2017-12-06 21:05:53 -08:00
Simon Willison 709f4f2798
Fixed bug with detecting FTS tables
Closes #135
2017-12-06 20:54:37 -08:00
Simon Willison 67ad77a307
Re-ordered docs index page 2017-12-06 10:27:50 -08:00
Simon Willison f9c32e717f
Linked to csvs-to-sqlite 2017-12-06 07:09:56 -08:00
Simon Willison f2dece01db
Documented _sql_time_limit_ms querystring argument
Closes #163
2017-12-06 07:06:56 -08:00
Simon Willison 7a4da7e5ae
Documentation for custom SQL queries
http://datasette.readthedocs.io/en/latest/sql_queries.html

Closes #20
2017-12-05 09:43:59 -08:00
Simon Willison b7b590b414
Docs for query.html CSS/template, refs #20 2017-12-05 08:35:14 -08:00
Simon Willison a743cdeafc
Canned query support + database/query template refactor
Named canned queries can now be defined in metadata.json like this:

    {
        "databases": {
            "timezones": {
                "queries": {
                    "timezone_for_point": "select tzid from timezones ..."
                }
            }
        }
    }

These will be shown in a new "Queries" section beneath "Views" on the database page.

As part of this, I refactored the logic for the database index page. It used
to combine the functionality for listing available tables and the
functionality for executing custom SQL queries in a single template and view.
I have split that template out into database.html and query.html and reworked
the view to more clearly separate the custom SQL executing code.

Refs #20
2017-12-05 08:17:02 -08:00
Simon Willison 0cfd7ce59d
Allow WITH query (previously we required SELECT at start)
Fixes #161
2017-12-03 20:51:31 -08:00
Simon Willison e981ac7d4d
--static option for datasette serve
You can now tell Datasette to serve static files from a specific location at a
specific mountpoint.

For example:

	datasette serve mydb.db --static extra-css:/tmp/static/css

Now if you visit this URL:

	http://localhost:8001/extra-css/blah.css

The following file will be served:

	/tmp/static/css/blah.css

Refs #160
2017-12-03 08:33:36 -08:00
Simon Willison 1ecac1a438
Fix display of select boxes in Firefox 2017-12-02 12:53:08 -08:00
Simon Willison 1feb5735da
Moved getting started into separate docs page 2017-11-30 10:27:00 -08:00
Simon Willison 601934936c
Documentation for custom CSS/JavaScript/Templates
Will go live at http://datasette.readthedocs.io/en/latest/custom_templates.html

Closes #156
2017-11-30 09:09:48 -08:00
Simon Willison cf46b86cf7
Switch to sphinx_rtd_theme 2017-11-30 08:56:20 -08:00
Simon Willison 3cd06729f4
Ability to over-ride templates for individual tables/databases
It is now possible to over-ride templates on a per-database / per-row or per-
table basis.

When you access e.g. /mydatabase/mytable Datasette will look for the following:

    - table-mydatabase-mytable.html
    - table.html

If you provided a --template-dir argument to datasette serve it will look in
that directory first.

The lookup rules are as follows:

    Index page (/):
        index.html

    Database page (/mydatabase):
        database-mydatabase.html
        database.html

    Table page (/mydatabase/mytable):
        table-mydatabase-mytable.html
        table.html

    Row page (/mydatabase/mytable/id):
        row-mydatabase-mytable.html
        row.html

If a table name has spaces or other unexpected characters in it, the template
filename will follow the same rules as our custom <body> CSS classes
introduced in 8ab3a169d4 - for example, a table called "Food Trucks"
will attempt to load the following templates:

    table-mydatabase-Food-Trucks-399138.html
    table.html

It is possible to extend the default templates using Jinja template
inheritance. If you want to customize EVERY row template with some additional
content you can do so by creating a row.html template like this:

    {% extends "default:row.html" %}

    {% block content %}
    <h1>EXTRA HTML AT THE TOP OF THE CONTENT BLOCK</h1>
    <p>This line renders the original block:</p>
    {{ super() }}
    {% endblock %}

Closes #12, refs #153
2017-11-30 08:38:16 -08:00
Simon Willison 7ff51598c4
git commit -m "datasette --template-dir=mytemplates/" argument
You can now pass an additional argument specifying a directory to look for
custom templates in.

Datasette will fall back on the default templates if a template is not
found in that directory.

Refs #12, #153
2017-11-30 08:05:01 -08:00