Wykres commitów

33 Commity (9277c6236a8216450d4ebe3242ce6d56c1a7e437)

Autor SHA1 Wiadomość Data
Simon Willison 969771770f
Upgrade pytest to 3.6.0
https://github.com/pytest-dev/pytest/issues/1875 made it impossible to declare
a function as a fixture multiple times, which we were doing across different
modules. The fix was to move our @pytest.fixture calls into decorators in the
tests/fixtures.py module.
2018-05-31 06:42:37 -07:00
Simon Willison 27c10f6482
Missing half of last commit fefb0db8ae 2018-05-28 13:42:48 -07:00
Simon Willison 50920cfe3d
allow_facet, allow_download, suggest_facets boolean --config
Refs #284
2018-05-24 18:12:27 -07:00
Simon Willison f6183ff5fa
Renamed --limit to --config, added --help-config, closes #274
Removed the --page_size= argument to datasette serve in favour of:

    datasette serve --config default_page_size:50 mydb.db

Added new help section:

    $ datasette --help-config
    Config options:
      default_page_size            Default page size for the table view
                                   (default=100)
      max_returned_rows            Maximum rows that can be returned from a table
                                   or custom query (default=1000)
      sql_time_limit_ms            Time limit for a SQL query in milliseconds
                                   (default=1000)
      default_facet_size           Number of values to return for requested facets
                                   (default=30)
      facet_time_limit_ms          Time limit for calculating a requested facet
                                   (default=200)
      facet_suggest_time_limit_ms  Time limit for calculating a suggested facet
                                   (default=50)
2018-05-20 10:01:49 -07:00
Simon Willison cef9a9a870
--limit= mechanism plus new limits for facets
Replaced the --max_returned_rows and --sql_time_limit_ms options to
"datasette serve" with a new --limit option, which supports a larger
list of limits.

Example usage:

	datasette serve --limit max_returned_rows:1000 \
		--limit sql_time_limit_ms:2500 \
		--limit default_facet_size:50 \
		--limit facet_time_limit_ms:1000 \
		--limit facet_suggest_time_limit_ms:500

New docs: https://datasette.readthedocs.io/en/latest/limits.html

Closes #270
Closes #264
2018-05-17 22:08:26 -07:00
Simon Willison 6d12580ed7 Foreign key facets are now expanded to labels, refs #255 2018-05-16 08:27:24 -07:00
Simon Willison f36c9d4b4c Facet toggling now works for integer columns, refs #255 2018-05-16 08:27:24 -07:00
Simon Willison eaaa3ea149
Initial implementation of facets, plus tests and docs
Refs #255
2018-05-12 19:29:41 -03:00
Simon Willison 801381b765
Default tests to using a longer timelimit
Every now and then a test will fail in Travis CI on Python 3.5 because it hit
the default 20ms SQL time limit.

Test fixtures now default to a 200ms time limit, and we only use the 20ms time
limit for the specific test that tests query interruption. This should make
our tests on Python 3.5 in Travis much more stable.
2018-05-05 19:44:32 -03:00
Simon Willison 1259b8ac0b
Support _search_COLUMN=text searches, closes #237 2018-05-05 19:33:08 -03:00
Simon Willison 4d6a568d6c
Unit tests for _search= feature, refs #237 2018-05-05 19:01:14 -03:00
Simon Willison 4504d5160b
If max_returned_rows==page_size, increment max_returned_rows
Fixes #230, where if the two were equal pagination didn't work correctly.
2018-04-25 21:04:12 -07:00
Simon Willison 02ee31c8b4
New hidden: True option for table metadat, closes #239 2018-04-25 20:42:57 -07:00
Simon Willison f3f4295712
label_column now defined on the table-being-linked-to, fixes #234 2018-04-22 13:46:18 -07:00
Simon Willison f27cabbaf3
label_column option in metadata.json - closes #234 2018-04-22 10:53:16 -07:00
Simon Willison b55809a1e2
Added /-/metadata /-/plugins /-/inspect, closes #225 2018-04-18 22:25:22 -07:00
Simon Willison 1c36d07dd4
New plugin hooks: extra_css_urls() and extra_js_urls()
Closes #214
2018-04-17 20:12:21 -07:00
Simon Willison aaf59db570
Longer time limit for test_paginate_compound_keys
It was failing intermittently in Travis - see #209
2018-04-17 18:09:48 -07:00
Simon Willison e7c769ef30
Working implementation of #216 which passes the tests
Reverted commit 5364fa7f33 (where I removed the
code that didn't work).

Added primary keys to order-by clause for sorting to get tests to pass
2018-04-16 18:41:55 -07:00
Simon Willison 5364fa7f33
Revert #216 until I can get tests to pass in Travis
Revert "Fix for _sort_desc=sortable_with_nulls test, refs #216"

This reverts commit 07fc2d113e.

Revert "Fixed #216 - paginate correctly when sorting by nullable column"

This reverts commit 2abe539a0f.
2018-04-16 17:53:37 -07:00
Simon Willison 2abe539a0f
Fixed #216 - paginate correctly when sorting by nullable column 2018-04-16 16:52:50 -07:00
Simon Willison b2955d9065
New --plugins-dir=plugins/ option (#212)
* New --plugins-dir=plugins/ option

New option causing Datasette to load and evaluate all of the Python files in
the specified directory and register any plugins that are defined in those
files.

This new option is available for the following commands:

    datasette serve mydb.db --plugins-dir=plugins/
    datasette publish now/heroku mydb.db --plugins-dir=plugins/
    datasette package mydb.db --plugins-dir=plugins/

* Unit tests for --plugins-dir=plugins/

Closes #211
2018-04-15 22:22:01 -07:00
Simon Willison dd4491dd81
Update number of expected tables 2018-04-14 08:16:54 -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 ed974417ad
Tests for unit filtering 2018-04-14 15:06:52 +01: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 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 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 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 306e1c6ac4
Broke up test_app into test_api and test_html 2017-12-15 04:08:24 -08:00