Wykres commitów

578 Commity (fix-regex-warnings)

Autor SHA1 Wiadomość Data
Simon Willison 38dc1ef73b
Show linked foreign key in table cells 2017-11-22 20:43:27 -08:00
Simon Willison 72e328dccf
Removed rogue print statement 2017-11-22 20:40:15 -08:00
Simon Willison 82c20ea36e
Added '- pick a column -' as first option 2017-11-22 20:39:53 -08:00
Simon Willison 0071b5d6f5
Added UI for editing table filters
Refs #86
2017-11-22 20:33:55 -08:00
Simon Willison 53534b6e9d
Even more complicated redirect scheme
This:

    ?_filter_column_1=name&_filter_op_1=contains&_filter_value_1=hello
    &_filter_column_2=age&_filter_op_2=gte&_filter_value_2=12

Now redirects to this:

    ?name__contains=hello&age__gte=12

This is needed for the filter editing interface, refs #86
2017-11-22 20:03:46 -08:00
Simon Willison c8e7c85fd3
Updated test_database_page test 2017-11-22 12:25:51 -08:00
Simon Willison 1c8638c30a
Hide FTS-created tables on index pages
Closes #129
2017-11-22 12:18:57 -08:00
Simon Willison f96e55bce5 Fix pytest version conflict
https://travis-ci.org/simonw/datasette/jobs/305929426

    pkg_resources.VersionConflict: (pytest 3.2.1 (/home/travis/virtualenv/python3.5.3/lib/python3.5/site-packages), 
    Requirement.parse('pytest==3.2.3'))
2017-11-22 12:17:51 -08:00
Simon Willison fa8eb0bf1b
Run unit tests against both Python 3.5 and 3.6 2017-11-22 09:43:52 -08:00
Simon Willison fb505de11c
Back-ported format strings for compatibility with Py 3.5
Also fixed a encoding error where Heroku --json return needs to be treated as UTF8
2017-11-22 09:42:29 -08:00
Simon Willison a9b9d42791
Mark FTS-related tables as 'hidden' in inspect()
Refs #129
2017-11-21 12:55:59 -08:00
Simon Willison e47117ce1d
Add publish to heroku support (merge pull request #104 from jacobian)
datasette publish heroku mydb.db
2017-11-21 12:55:04 -08:00
Jacob Kaplan-Moss de42240afd Some bug fixes. 2017-11-21 10:51:58 -08:00
Jacob Kaplan-Moss 75450abbe8 Merge branch 'master' into publish-heroku 2017-11-21 10:19:42 -08:00
Jacob Kaplan-Moss 1f79be7e4e More error checking and docs 2017-11-21 10:10:48 -08:00
Simon Willison 0331666e34
?_search=x now works directly against fts virtual table
Closes #135
2017-11-19 22:18:07 -08:00
Simon Willison 771b0ee347
Initial implementation of ?_group_count=column
URL shortcut for counting rows grouped by one or more columns.

?_group_count=column1&_group_count=column2 works as well.

SQL generated looks like this:

    select "qSpecies", count(*) as "count"
    from Street_Tree_List
    group by "qSpecies"
    order by "count" desc limit 100

Or for two columns like this:

    select "qSpecies", "qSiteInfo", count(*) as "count"
    from Street_Tree_List
    group by "qSpecies", "qSiteInfo"
    order by "count" desc limit 100

Refs #44

Still todo: clean up code a bunch (it currently fakes being a 'view'), get
foreign key expansion working.
2017-11-19 22:04:13 -08:00
Simon Willison b4e6211a97
Refactored filter logic and added human descriptions - refs #86 2017-11-19 22:03:24 -08:00
Simon Willison 523c6f9e3a
Fixed bug with FTS against tables with hyphens in the name 2017-11-19 21:59:53 -08:00
Simon Willison a5881e105a
?_filter_column=col&_filter_op=isnull__1 redirect
if filter_op contains a __ the value is set to the right hand side.

e.g.

    ?_filter_column=col&_filter_op=isnull__1&_filter_value=x

Redirects to:

    ?col__isnull=1

Refs #86
2017-11-19 12:33:30 -08:00
Simon Willison 386fb11d42
?_filter_column=col&_filter_op=op&_filter_value=value redirect
Part of implementing the filters UI (refs #86) - the following:

    /trees/Trees?_filter_column=SiteOrder&_filter_op=gt&_filter_value=2

Now redirects to this;

    /trees/Trees?SiteOrder__gt=2
2017-11-19 12:25:29 -08:00
Simon Willison ddc808f387
Added --build=master option to datasette publish and package
The `datasette publish` and `datasette package` commands both now accept an
optional `--build` argument. If provided, this can be used to specify a branch
published to GitHub that should be built into the container.

This makes it easier to test code that has not yet been officially released to
PyPI, e.g.:

    datasette publish now mydb.db --branch=master
2017-11-19 10:20:17 -08:00
Simon Willison eed6a0fe36
Implemented ?_search=XXX + UI if a FTS table is detected
Closes #131
2017-11-19 08:59:26 -08:00
Simon Willison f59c840e7d
Show row count for custom SQL queries 2017-11-19 07:54:50 -08:00
Simon Willison 80ada4dbb3
Added 'datasette --version' support
Using http://click.pocoo.org/5/api/#click.version_option
2017-11-18 21:59:16 -08:00
Simon Willison 1b04662585 Table views now show expanded foreign key references, if possible
If a table has foreign key columns, and those foreign key tables have
label_columns, the TableView will now query those other tables for the
corresponding values and display those values as links in the corresponding
table cells.

label_columns are currently detected by the inspect() function, which looks
for any table that has just two columns - an ID column and one other - and
sets the label_column to be that second non-ID column.
2017-11-17 19:15:49 -08:00
Simon Willison 6a007f6322 Row pages show incoming foreign key relationships 2017-11-17 19:15:49 -08:00
Simon Willison 7feb746efe Fixed bug where 0 values were showing up blank 2017-11-17 19:15:49 -08:00
Robert Gieseke 6d39429daa Don't prevent tabbing to `Run SQL` button (#117)
See comment in #115
2017-11-17 16:53:42 -08:00
Jacob Kaplan-Moss 54d58ef690 Merge branch 'master' into publish-heroku 2017-11-17 13:36:50 -08:00
Jacob Kaplan-Moss 6eb23d2143 Moved `datasette build` to a post_compile hook. 2017-11-17 12:09:01 -08:00
Simon Willison 0b702f3679 Fixed weird edge-case with foreign key detection
It turns out it is possible for a SQLite table to define a foreign key
relationship to a table that does not actually exist

We should still be able to handle these databases.
2017-11-17 08:18:26 -08:00
Simon Willison 45e502aace Added unit tests for inspect() foreign key detection
Used them to fix a bug with it.

Refs #85
2017-11-17 08:08:11 -08:00
Simon Willison e16ca1169c Refactored table column/row display logic
Simplified the template and made the way for upcoming foreign key work.

Refs #85

Also fixed   bug on database page - closes #113
2017-11-17 07:39:36 -08:00
Simon Willison 084350b0f1 Switched to gather_request=False for Sanic tests
Gets rid of those ugly _, response = lines.
2017-11-17 06:53:37 -08:00
Robert Gieseke eda848b37f Add keyboard shortcut to execute SQL query (#115) 2017-11-17 06:22:55 -08:00
Simon Willison f3445e2d13 Install python3-dev rothar than python-dev 2017-11-17 06:18:49 -08:00
Simon Willison 1a6cfcc10f Added a .dockerignore
Figured this would be useful while testing out 03572ae355
2017-11-17 06:18:23 -08:00
Simon Willison 03572ae355 Allow --load-extension to be set via environment variable
I tesed this by first building and running a container using the new
Dockerfile from #114:

    docker build .
    docker run -it -p 8001:8001 6c9ca7e29181 /bin/sh

Then I ran this inside the container itself:

    apt update && apt-get install wget -y \
        && wget http://www.gaia-gis.it/spatialite-2.3.1/test-2.3.sqlite.gz \
        && gunzip test-2.3.sqlite.gz \
        && mv test-2.3.sqlite test23.sqlite \
        && datasette -h 0.0.0.0 test23.sqlite

I visited this URL to confirm I got an error due to spatialite not being
loaded:

http://localhost:8001/test23-c88bc35?sql=select+ST_AsText%28Geometry%29+from+HighWays+limit+1

Then I checked that loading it with `--load-extension` worked correctly:

    datasette -h 0.0.0.0 test23.sqlite \
        --load-extension=/usr/lib/x86_64-linux-gnu/mod_spatialite.so

Then, finally, I tested it with the new environment variable option:

    SQLITE_EXTENSIONS=/usr/lib/x86_64-linux-gnu/mod_spatialite.so \
        datasette -h 0.0.0.0 test23.sqlite

Running it with an invalid environment variable option shows an error:

    $ SQLITE_EXTENSIONS=/usr/lib/x86_64-linux-gnu/blah.so datasette \
        -h 0.0.0.0 test23.sqlite
    Usage: datasette -h [OPTIONS] [FILES]...

    Error: Invalid value for "--load-extension": Path "/usr/lib/x86_64-linux-gnu/blah.so" does not exist.

Closes #112
2017-11-17 06:13:35 -08:00
Ray N ed2b3f25be add support for ?field__isnull=1 (#107)
* add support for ?field__isnull=1

* Add unit test and conditional formatting for ?field__isnull
2017-11-17 05:29:22 -08:00
Simon Willison b9af49be6c
Fix case for Sanic dependency
On PyPI it has a capital letter: https://pypi.python.org/pypi/Sanic

I think this is why the list of "Requires Distributions" on https://pypi.python.org/pypi/datasette links to all of the other dependencies but does not link to Sanic.
2017-11-17 05:26:05 -08:00
Ariel Núñez 8b4c600d98 Add spatialite, switch to debian and local build (#114) 2017-11-16 19:50:51 -08:00
Simon Willison b7c4165346 Added --load-extension argument to datasette serve
Allows loading of SQLite extensions. Refs #110.
2017-11-16 08:48:49 -08:00
Simon Willison 9e27b2a0ba Add example of named parameter UI to the release notes 2017-11-16 08:46:25 -08:00
Simon Willison 5bfb23b949
Added Read The Docs badge
Closes #109
2017-11-16 08:13:55 -08:00
Simon Willison a9138f044a Added date to most recent changelog entry 2017-11-16 07:40:43 -08:00
Simon Willison 51bdd67691 Changelog for 0.12 release 2017-11-16 07:37:46 -08:00
Simon Willison 01e0c3fa18 Fixed   bug
  was showing for all None values in table cells, thanks to the
autoescaping change introduced in 82261a638b
2017-11-16 07:29:52 -08:00
Simon Willison 228bce83a3 Added __version__, bumped it to 0.12
Closes #108
2017-11-16 07:20:54 -08:00
Simon Willison e6ca885883 Added initial docs, including a changelog
Docs initialized using this helpful guide:

http://docs.readthedocs.io/en/latest/getting_started.html

I used https://pypi.python.org/pypi/gitchangelog to kick-start the changelog.

Closes #99

Refs #109
2017-11-16 07:11:00 -08:00