datasette/tests
Simon Willison 3a79ad98ea
Basic CSV export, refs #266
Tables and custom SQL query results can now be exported as CSV.

The easiest way to do this is to use the .csv extension, e.g.

	/test_tables/facet_cities.csv

By default this is served as Content-Type: text/plain so you can see it in
your browser. If you want to download the file (using text/csv and with an
appropriate Content-Disposition: attachment header) you can do so like this:

	/test_tables/facet_cities.csv?_dl=1

We link to the CSV and downloadable CSV URLs from the table and query pages.

The links use ?_size=max and so by default will return 1,000 rows.

Also fixes #303 - table names ending in .json or .csv are now detected and
URLs are generated that look like this instead:

	/test_tables/table%2Fwith%2Fslashes.csv?_format=csv

The ?_format= option is available for everything else too, but we link to the
.csv / .json versions in most cases because they are aesthetically pleasing.
2018-06-14 23:51:23 -07:00
..
__init__.py Broke up test_app into test_api and test_html 2017-12-15 04:08:24 -08:00
fixtures.py Test client wrapper removing need for gather_request - refs #272 2018-06-04 20:53:12 -07:00
test_api.py Basic CSV export, refs #266 2018-06-14 23:51:23 -07:00
test_csv.py Basic CSV export, refs #266 2018-06-14 23:51:23 -07:00
test_docs.py Test that ensures all config options are documented 2018-05-26 15:11:16 -07:00
test_html.py Basic CSV export, refs #266 2018-06-14 23:51:23 -07:00
test_inspect.py Use scope='session' for all fixtures 2018-05-28 13:41:06 -07:00
test_plugins.py Test client wrapper removing need for gather_request - refs #272 2018-06-04 20:53:12 -07:00
test_utils.py Basic CSV export, refs #266 2018-06-14 23:51:23 -07:00