html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,issue,performed_via_github_app https://github.com/simonw/datasette/pull/1812#issuecomment-1249355888,https://api.github.com/repos/simonw/datasette/issues/1812,1249355888,IC_kwDOBm6k_c5Kd6hw,22429695,2022-09-16T13:18:37Z,2022-09-16T13:18:37Z,NONE,"# [Codecov](https://codecov.io/gh/simonw/datasette/pull/1812?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison) Report Base: **91.70**% // Head: **91.70**% // No change to project coverage :thumbsup: > Coverage data is based on head [(`b3855e7`)](https://codecov.io/gh/simonw/datasette/pull/1812?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison) compared to base [(`b40872f`)](https://codecov.io/gh/simonw/datasette/commit/b40872f5e5ae5dad331c58f75451e2d206565196?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison). > Patch has no changes to coverable lines.
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1812 +/- ## ======================================= Coverage 91.70% 91.70% ======================================= Files 38 38 Lines 4735 4735 ======================================= Hits 4342 4342 Misses 393 393 ``` Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison)
[:umbrella: View full report at Codecov](https://codecov.io/gh/simonw/datasette/pull/1812?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison). :loudspeaker: Do you have feedback about the report comment? [Let us know in this issue](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison). ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1375930971, https://github.com/simonw/datasette/pull/1812#issuecomment-1249746777,https://api.github.com/repos/simonw/datasette/issues/1812,1249746777,IC_kwDOBm6k_c5KfZ9Z,9599,2022-09-16T19:50:45Z,2022-09-16T19:50:45Z,OWNER,"Main difference I can see: ![CleanShot 2022-09-16 at 12 49 47@2x](https://user-images.githubusercontent.com/9599/190719563-a7b1bcc7-bfdc-4759-95c1-e19bcd0217c3.png) ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1375930971, https://github.com/simonw/datasette/pull/1812#issuecomment-1249745637,https://api.github.com/repos/simonw/datasette/issues/1812,1249745637,IC_kwDOBm6k_c5KfZrl,9599,2022-09-16T19:49:12Z,2022-09-16T19:49:12Z,OWNER,Preview looks good.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1375930971, https://github.com/simonw/datasette/issues/1809#issuecomment-1249985741,https://api.github.com/repos/simonw/datasette/issues/1809,1249985741,IC_kwDOBm6k_c5KgUTN,9599,2022-09-17T03:04:51Z,2022-09-17T03:04:51Z,OWNER,I'm going to throw an error in `ds.render_template()` if you haven't previously called `await ds.invoke_startup()`.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1373595927, https://github.com/simonw/datasette/issues/1809#issuecomment-1249985971,https://api.github.com/repos/simonw/datasette/issues/1809,1249985971,IC_kwDOBm6k_c5KgUWz,9599,2022-09-17T03:06:32Z,2022-09-17T03:06:32Z,OWNER,"This is likely going to cause some tests in plugins to break, but I'm OK with that - I'll fix them as I find them once this release is out.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1373595927, https://github.com/simonw/datasette/issues/1809#issuecomment-1249986079,https://api.github.com/repos/simonw/datasette/issues/1809,1249986079,IC_kwDOBm6k_c5KgUYf,9599,2022-09-17T03:07:24Z,2022-09-17T03:07:24Z,OWNER,"Datasette's own tests started to break because calls to the `TestClient` were performed without awaiting that method. I fixed that by adding this to `_request()` inside that class: ```python async def _request( self, path, follow_redirects=True, redirect_count=0, method=""GET"", cookies=None, headers=None, post_body=None, content_type=None, if_none_match=None, ): if not self.ds._startup_invoked: await self.ds.invoke_startup() ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1373595927, https://github.com/simonw/datasette/issues/1809#issuecomment-1249987643,https://api.github.com/repos/simonw/datasette/issues/1809,1249987643,IC_kwDOBm6k_c5KgUw7,9599,2022-09-17T03:19:24Z,2022-09-17T03:19:24Z,OWNER,"In looking at the documentation on [writing tests](https://docs.datasette.io/en/latest/testing_plugins.html), there are a lot of examples like this: ```python def test_that_opens_the_debugger_or_errors(): ds = Datasette([db_path], pdb=True) response = await ds.client.get(""/"") ``` I really don't like having to tell people to add `await ds.invoke_startup()` to every test that might look like this. Since it's safe to call that function multiple times, I'm going to have `ds.client.get()` and friends call it for you too - so if you forget in a plugin test it won't matter.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1373595927, https://github.com/simonw/datasette/issues/1809#issuecomment-1249990033,https://api.github.com/repos/simonw/datasette/issues/1809,1249990033,IC_kwDOBm6k_c5KgVWR,9599,2022-09-17T03:39:05Z,2022-09-17T03:39:05Z,OWNER,New docs section on the need to call `await ds.invoke_startup()`: https://github.com/simonw/datasette/blob/ddc999ad1296e8c69cffede3e367dda059b8adad/docs/testing_plugins.rst#setting-up-a-datasette-test-instance,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1373595927, https://github.com/simonw/datasette/issues/1813#issuecomment-1250901367,https://api.github.com/repos/simonw/datasette/issues/1813,1250901367,IC_kwDOBm6k_c5Kjz13,883348,2022-09-19T11:34:45Z,2022-09-19T11:34:45Z,CONTRIBUTOR,"oh and by writing this I just realized the difference: the URL on fly.io is with a custom SQL command whereas the local one is without. It seems that there is no pagination when using custom SQL commands which makes sense Sorry for this useless issue, maybe this can be useful for someone else / me in the future. Thanks again for this wonderful project !","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1377811868, https://github.com/simonw/datasette/issues/1816#issuecomment-1251724180,https://api.github.com/repos/simonw/datasette/issues/1816,1251724180,IC_kwDOBm6k_c5Km8uU,9599,2022-09-20T01:13:05Z,2022-09-20T01:13:05Z,OWNER,"Oops, that has a bug: ``` Error: Invalid setting '{key}' in settings.json ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1378640768, https://github.com/simonw/datasette/issues/1814#issuecomment-1251677220,https://api.github.com/repos/simonw/datasette/issues/1814,1251677220,IC_kwDOBm6k_c5KmxQk,9599,2022-09-19T23:34:30Z,2022-09-19T23:34:30Z,OWNER,"The `settings.json` file can only be used with settings that are set using `--setting name value` - the full list of those is here: https://docs.datasette.io/en/stable/settings.html The `--static` option works differently. In configuration directory mode you can skip it entirely and instead have a `/static/` folder - so your directory structure would look like this: ``` bibliography/static/styles.css ``` And then when you run `datasette bibliography/` the following URL will work: http://127.0.0.1:8001/static/styles.css ","{""total_count"": 1, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 1, ""eyes"": 0}",1378495690, https://github.com/simonw/datasette/issues/1814#issuecomment-1251677554,https://api.github.com/repos/simonw/datasette/issues/1814,1251677554,IC_kwDOBm6k_c5KmxVy,9599,2022-09-19T23:35:06Z,2022-09-19T23:35:06Z,OWNER,It might have been useful for Datasette to show an error when started against a `settings.json` file that contains an invalid setting though.,"{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1378495690, https://github.com/simonw/datasette/issues/1816#issuecomment-1251682970,https://api.github.com/repos/simonw/datasette/issues/1816,1251682970,IC_kwDOBm6k_c5Kmyqa,9599,2022-09-19T23:44:54Z,2022-09-19T23:44:54Z,OWNER,"I was going to add type validation too, but that's actually a bit tricky because the logic for that currently lives in Click option parsing here: https://github.com/simonw/datasette/blob/ddc999ad1296e8c69cffede3e367dda059b8adad/datasette/cli.py#L71-L88","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1378640768, https://github.com/simonw/datasette/issues/526#issuecomment-1254064260,https://api.github.com/repos/simonw/datasette/issues/526,1254064260,IC_kwDOBm6k_c5Kv4CE,536941,2022-09-21T18:17:04Z,2022-09-21T18:18:01Z,CONTRIBUTOR,"hi @simonw, this is becoming more of a bother for my [labor data warehouse](https://labordata.bunkum.us/). Is there any research or a spike i could do that would help you investigate this issue?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",459882902, https://github.com/simonw/datasette/issues/1646#issuecomment-1272149176,https://api.github.com/repos/simonw/datasette/issues/1646,1272149176,IC_kwDOBm6k_c5L03S4,9599,2022-10-07T23:06:17Z,2022-10-07T23:06:17Z,OWNER,Updated documentation: https://docs.datasette.io/en/latest/settings.html#configuration-directory-mode,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1157182254, https://github.com/simonw/datasette/issues/1362#issuecomment-1272228740,https://api.github.com/repos/simonw/datasette/issues/1362,1272228740,IC_kwDOBm6k_c5L1KuE,9599,2022-10-08T05:03:56Z,2022-10-08T05:03:56Z,OWNER,Useful example: how Play framework does this https://www.playframework.com/documentation/2.8.1/CspFilter,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",912864936, https://github.com/simonw/datasette/issues/1836#issuecomment-1272344884,https://api.github.com/repos/simonw/datasette/issues/1836,1272344884,IC_kwDOBm6k_c5L1nE0,9599,2022-10-08T15:41:28Z,2022-10-08T15:41:28Z,OWNER,"Lets switch to `mode=ro` when the `inspect` command runs, we can use this issue for that.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1400374908, https://github.com/simonw/datasette/issues/1836#issuecomment-1272357976,https://api.github.com/repos/simonw/datasette/issues/1836,1272357976,IC_kwDOBm6k_c5L1qRY,536941,2022-10-08T16:56:51Z,2022-10-08T16:56:51Z,CONTRIBUTOR,"when you are running from docker, you **always** will want to run as `mode=ro` because the same thing that is causing duplication in the inspect layer will cause duplication in the final container read/write layer when `datasette serve` runs.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1400374908, https://github.com/simonw/datasette/issues/1362#issuecomment-1272369443,https://api.github.com/repos/simonw/datasette/issues/1362,1272369443,IC_kwDOBm6k_c5L1tEj,9599,2022-10-08T18:03:03Z,2022-10-08T18:03:03Z,OWNER,Asked for tips on Twitter: https://twitter.com/simonw/status/1578561096520114176,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",912864936, https://github.com/simonw/datasette/issues/1362#issuecomment-1272369603,https://api.github.com/repos/simonw/datasette/issues/1362,1272369603,IC_kwDOBm6k_c5L1tHD,9599,2022-10-08T18:03:56Z,2022-10-08T18:03:56Z,OWNER,This document is useful: https://csp.withgoogle.com/docs/strict-csp.html,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",912864936, https://github.com/simonw/datasette/issues/1362#issuecomment-1272369712,https://api.github.com/repos/simonw/datasette/issues/1362,1272369712,IC_kwDOBm6k_c5L1tIw,9599,2022-10-08T18:04:31Z,2022-10-08T18:05:05Z,OWNER,Also this series: https://scotthelme.co.uk/tag/csp/ - via https://twitter.com/adamchainz/status/1578762884481368065,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",912864936, https://github.com/simonw/datasette/issues/1362#issuecomment-1272376377,https://api.github.com/repos/simonw/datasette/issues/1362,1272376377,IC_kwDOBm6k_c5L1uw5,9599,2022-10-08T18:42:09Z,2022-10-08T18:42:09Z,OWNER,And a useful cheat sheet https://scotthelme.co.uk/csp-cheat-sheet/,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",912864936, https://github.com/simonw/datasette/issues/526#issuecomment-1258337011,https://api.github.com/repos/simonw/datasette/issues/526,1258337011,IC_kwDOBm6k_c5LALLz,536941,2022-09-26T16:49:48Z,2022-09-26T16:49:48Z,CONTRIBUTOR,"i think the smallest change that gets close to what i want is to change the behavior so that `max_returned_rows` is not applied in the `execute` method when we are are asking for a csv of query. there are some infelicities for that approach, but i'll make a PR to make it easier to discuss.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",459882902, https://github.com/simonw/datasette/pull/1820#issuecomment-1258803261,https://api.github.com/repos/simonw/datasette/issues/1820,1258803261,IC_kwDOBm6k_c5LB9A9,536941,2022-09-27T00:03:09Z,2022-09-27T00:03:09Z,CONTRIBUTOR,"the pattern in this PR `max_returned_rows` control the maximum rows rendered through html and json, and the csv render bypasses that. i think it would be better to have each of these different query renderers have more direct control for how many rows to fetch, instead of relying on the internals of the `execute` method. generally, users will not want to paginate through tens of thousands of results, but often will want to download a full query as json or as csv. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1386456717, https://github.com/simonw/datasette/pull/1820#issuecomment-1258601033,https://api.github.com/repos/simonw/datasette/issues/1820,1258601033,IC_kwDOBm6k_c5LBLpJ,22429695,2022-09-26T20:32:47Z,2022-10-07T03:58:13Z,NONE,"# [Codecov](https://codecov.io/gh/simonw/datasette/pull/1820?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison) Report Base: **92.50**% // Head: **92.51**% // Increases project coverage by **`+0.01%`** :tada: > Coverage data is based on head [(`9bead2a`)](https://codecov.io/gh/simonw/datasette/pull/1820?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison) compared to base [(`eff1124`)](https://codecov.io/gh/simonw/datasette/commit/eff112498ecc499323c26612d707908831446d25?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison). > Patch coverage: 100.00% of modified lines in pull request are covered.
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1820 +/- ## ========================================== + Coverage 92.50% 92.51% +0.01% ========================================== Files 35 35 Lines 4400 4406 +6 ========================================== + Hits 4070 4076 +6 Misses 330 330 ``` | [Impacted Files](https://codecov.io/gh/simonw/datasette/pull/1820?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison) | Coverage Δ | | |---|---|---| | [datasette/app.py](https://codecov.io/gh/simonw/datasette/pull/1820/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison#diff-ZGF0YXNldHRlL2FwcC5weQ==) | `94.11% <ø> (ø)` | | | [datasette/views/base.py](https://codecov.io/gh/simonw/datasette/pull/1820/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison#diff-ZGF0YXNldHRlL3ZpZXdzL2Jhc2UucHk=) | `94.80% <100.00%> (+0.05%)` | :arrow_up: | | [datasette/views/database.py](https://codecov.io/gh/simonw/datasette/pull/1820/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison#diff-ZGF0YXNldHRlL3ZpZXdzL2RhdGFiYXNlLnB5) | `95.29% <100.00%> (+0.06%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison)
[:umbrella: View full report at Codecov](https://codecov.io/gh/simonw/datasette/pull/1820?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison). :loudspeaker: Do you have feedback about the report comment? [Let us know in this issue](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison). ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1386456717, https://github.com/simonw/datasette/issues/1821#issuecomment-1258692555,https://api.github.com/repos/simonw/datasette/issues/1821,1258692555,IC_kwDOBm6k_c5LBh_L,9599,2022-09-26T22:06:39Z,2022-09-26T22:06:39Z,OWNER,"- https://github.com/simonw/datasette/actions/runs/3131344150 - https://github.com/simonw/datasette/releases/tag/0.63a0 - https://pypi.org/project/datasette/0.63a0/","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1386734383, https://github.com/simonw/datasette/issues/1818#issuecomment-1258735283,https://api.github.com/repos/simonw/datasette/issues/1818,1258735283,IC_kwDOBm6k_c5LBsaz,9599,2022-09-26T22:47:19Z,2022-09-26T22:47:19Z,OWNER,"That's a really interesting idea: for a lot of databases (those made out of straight imports from CSV) `max(rowid)` would indeed reflect the size of the table, but would be a MUCH faster operation than attempting a `count(*)`.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1384549993, https://github.com/simonw/datasette/issues/1818#issuecomment-1258735747,https://api.github.com/repos/simonw/datasette/issues/1818,1258735747,IC_kwDOBm6k_c5LBsiD,9599,2022-09-26T22:47:59Z,2022-09-26T22:47:59Z,OWNER,Another option here is to tie into a feature I built in `sqlite-utils` with this problem in mind but never introduced on the Datasette side of things: https://sqlite-utils.datasette.io/en/stable/python-api.html#cached-table-counts-using-triggers,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1384549993, https://github.com/simonw/datasette/issues/1819#issuecomment-1258738435,https://api.github.com/repos/simonw/datasette/issues/1819,1258738435,IC_kwDOBm6k_c5LBtMD,9599,2022-09-26T22:52:19Z,2022-09-26T22:52:19Z,OWNER,This is a good idea.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1385026210, https://github.com/simonw/datasette/issues/1818#issuecomment-1258738740,https://api.github.com/repos/simonw/datasette/issues/1818,1258738740,IC_kwDOBm6k_c5LBtQ0,5363,2022-09-26T22:52:45Z,2022-09-26T22:55:57Z,NONE,"thoughts on order of precedence to use: * sqlite-utils count, if present. closest thing to a standard i guess. * row(max_id) if like, the first and/or last x amount of rows ids are all contiguous. kind of a cheap/dumb/imperfect heuristic to see if the table is dump/not dump. if the check passes, still stick on `est.` after the display. * count(*) if enabled in datasette ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1384549993, https://github.com/simonw/datasette/issues/1819#issuecomment-1258746600,https://api.github.com/repos/simonw/datasette/issues/1819,1258746600,IC_kwDOBm6k_c5LBvLo,9599,2022-09-26T23:05:40Z,2022-09-26T23:05:40Z,OWNER,"Implementing it like this, so at least you can copy and paste the SQL query back out again: I'm not doing a full textarea because this error can be raised in multiple places, including on the table page itself. It's not just an error associated with the manual query page.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1385026210, https://github.com/simonw/datasette/issues/1822#issuecomment-1258757544,https://api.github.com/repos/simonw/datasette/issues/1822,1258757544,IC_kwDOBm6k_c5LBx2o,9599,2022-09-26T23:21:23Z,2022-09-26T23:21:23Z,OWNER,Everything on https://docs.datasette.io/en/stable/internals.html that uses keyword arguments should do this I think.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1386854246, https://github.com/simonw/datasette/issues/1819#issuecomment-1258754105,https://api.github.com/repos/simonw/datasette/issues/1819,1258754105,IC_kwDOBm6k_c5LBxA5,9599,2022-09-26T23:16:15Z,2022-09-26T23:16:15Z,OWNER,Demo: https://latest.datasette.io/_memory?sql=with+recursive+counter(x)+as+(%0D%0A++select+0%0D%0A++++union%0D%0A++select+x+%2B+1+from+counter%0D%0A)%2C%0D%0Ablah+as+(select+*+from+counter+limit+5000000)%0D%0Aselect+count(*)+from+blah,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1385026210, https://github.com/simonw/datasette/issues/1817#issuecomment-1258756231,https://api.github.com/repos/simonw/datasette/issues/1817,1258756231,IC_kwDOBm6k_c5LBxiH,9599,2022-09-26T23:19:34Z,2022-09-26T23:19:34Z,OWNER,"This is a good idea - it's something I should do before Datasette 1.0. I was a tiny bit worried about compatibility (Datasette is 3.7+) but it looks like they have been in Python since 3.0!","{""total_count"": 1, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 1, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1384273985, https://github.com/simonw/datasette/issues/1822#issuecomment-1258760299,https://api.github.com/repos/simonw/datasette/issues/1822,1258760299,IC_kwDOBm6k_c5LByhr,9599,2022-09-26T23:25:12Z,2022-09-26T23:25:55Z,OWNER,"A start: ```diff diff --git a/datasette/utils/asgi.py b/datasette/utils/asgi.py index 8a2fa060..41ade961 100644 --- a/datasette/utils/asgi.py +++ b/datasette/utils/asgi.py @@ -118,7 +118,7 @@ class Request: return dict(parse_qsl(body.decode(""utf-8""), keep_blank_values=True)) @classmethod - def fake(cls, path_with_query_string, method=""GET"", scheme=""http"", url_vars=None): + def fake(cls, path_with_query_string, *, method=""GET"", scheme=""http"", url_vars=None): """"""Useful for constructing Request objects for tests"""""" path, _, query_string = path_with_query_string.partition(""?"") scope = { @@ -204,7 +204,7 @@ class AsgiWriter: ) -async def asgi_send_json(send, info, status=200, headers=None): +async def asgi_send_json(send, info, *, status=200, headers=None): headers = headers or {} await asgi_send( send, @@ -215,7 +215,7 @@ async def asgi_send_json(send, info, status=200, headers=None): ) -async def asgi_send_html(send, html, status=200, headers=None): +async def asgi_send_html(send, html, *, status=200, headers=None): headers = headers or {} await asgi_send( send, @@ -226,7 +226,7 @@ async def asgi_send_html(send, html, status=200, headers=None): ) -async def asgi_send_redirect(send, location, status=302): +async def asgi_send_redirect(send, location, *, status=302): await asgi_send( send, """", @@ -236,12 +236,12 @@ async def asgi_send_redirect(send, location, status=302): ) -async def asgi_send(send, content, status, headers=None, content_type=""text/plain""): +async def asgi_send(send, content, status, *, headers=None, content_type=""text/plain""): await asgi_start(send, status, headers, content_type) await send({""type"": ""http.response.body"", ""body"": content.encode(""utf-8"")}) -async def asgi_start(send, status, headers=None, content_type=""text/plain""): +async def asgi_start(send, status, *, headers=None, content_type=""text/plain""): headers = headers or {} # Remove any existing content-type header headers = {k: v for k, v in headers.items() if k.lower() != ""content-type""} @@ -259,7 +259,7 @@ async def asgi_start(send, status, headers=None, content_type=""text/plain""): async def asgi_send_file( - send, filepath, filename=None, content_type=None, chunk_size=4096, headers=None + send, filepath, filename=None, *, content_type=None, chunk_size=4096, headers=None ): headers = headers or {} if filename: @@ -284,7 +284,7 @@ async def asgi_send_file( ) -def asgi_static(root_path, chunk_size=4096, headers=None, content_type=None): +def asgi_static(root_path, *, chunk_size=4096, headers=None, content_type=None): root_path = Path(root_path) async def inner_static(request, send): @@ -313,7 +313,7 @@ def asgi_static(root_path, chunk_size=4096, headers=None, content_type=None): class Response: - def __init__(self, body=None, status=200, headers=None, content_type=""text/plain""): + def __init__(self, body=None, *, status=200, headers=None, content_type=""text/plain""): self.body = body self.status = status self.headers = headers or {} @@ -346,6 +346,7 @@ class Response: self, key, value="""", + *, max_age=None, expires=None, path=""/"", @@ -374,7 +375,7 @@ class Response: self._set_cookie_headers.append(cookie.output(header="""").strip()) @classmethod - def html(cls, body, status=200, headers=None): + def html(cls, body, *, status=200, headers=None): return cls( body, status=status, @@ -383,7 +384,7 @@ class Response: ) @classmethod - def text(cls, body, status=200, headers=None): + def text(cls, body, *, status=200, headers=None): return cls( str(body), status=status, @@ -392,7 +393,7 @@ class Response: ) @classmethod - def json(cls, body, status=200, headers=None, default=None): + def json(cls, body, *, status=200, headers=None, default=None): return cls( json.dumps(body, default=default), status=status, @@ -401,7 +402,7 @@ class Response: ) @classmethod - def redirect(cls, path, status=302, headers=None): + def redirect(cls, path, *, status=302, headers=None): headers = headers or {} headers[""Location""] = path return cls("""", status=status, headers=headers) @@ -412,6 +413,7 @@ class AsgiFileDownload: self, filepath, filename=None, + *, content_type=""application/octet-stream"", headers=None, ): ``` ```diff diff --git a/datasette/app.py b/datasette/app.py index 03d1dacc..4d4e5584 100644 --- a/datasette/app.py +++ b/datasette/app.py @@ -190,6 +190,7 @@ class Datasette: def __init__( self, files=None, + *, immutables=None, cache_headers=True, cors=False, ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1386854246, https://github.com/simonw/datasette/issues/1817#issuecomment-1258818028,https://api.github.com/repos/simonw/datasette/issues/1817,1258818028,IC_kwDOBm6k_c5LCAns,9599,2022-09-27T00:27:53Z,2022-09-27T00:27:53Z,OWNER,"Made a start on this: ```diff diff --git a/datasette/hookspecs.py b/datasette/hookspecs.py index 34e19664..fe0971e5 100644 --- a/datasette/hookspecs.py +++ b/datasette/hookspecs.py @@ -31,25 +31,29 @@ def prepare_jinja2_environment(env, datasette): @hookspec -def extra_css_urls(template, database, table, columns, view_name, request, datasette): +def extra_css_urls( + template, database, table, columns, sql, params, view_name, request, datasette +): """"""Extra CSS URLs added by this plugin"""""" @hookspec -def extra_js_urls(template, database, table, columns, view_name, request, datasette): +def extra_js_urls( + template, database, table, columns, sql, params, view_name, request, datasette +): """"""Extra JavaScript URLs added by this plugin"""""" @hookspec def extra_body_script( - template, database, table, columns, view_name, request, datasette + template, database, table, columns, sql, params, view_name, request, datasette ): """"""Extra JavaScript code to be included in