html_url,issue_url,id,node_id,user,user_label,created_at,updated_at,author_association,body,reactions,issue,issue_label,performed_via_github_app
https://github.com/simonw/datasette/issues/1773#issuecomment-1196165351,https://api.github.com/repos/simonw/datasette/issues/1773,1196165351,IC_kwDOBm6k_c5HTAjn,9599,simonw,2022-07-27T01:24:13Z,2022-07-27T01:24:13Z,OWNER,"Traceback:
```
Traceback (most recent call last):
File ""/Users/simon/Dropbox/Development/datasette/datasette/app.py"", line 1264, in route_path
response = await view(request, send)
File ""/Users/simon/Dropbox/Development/datasette/datasette/views/base.py"", line 134, in view
return await self.dispatch_request(request)
File ""/Users/simon/Dropbox/Development/datasette/datasette/views/base.py"", line 91, in dispatch_request
return await handler(request)
File ""/Users/simon/Dropbox/Development/datasette/datasette/views/base.py"", line 361, in get
response_or_template_contexts = await self.data(request, **data_kwargs)
File ""/Users/simon/Dropbox/Development/datasette/datasette/views/table.py"", line 157, in data
return await self._data_traced(request, default_labels, _next, _size)
File ""/Users/simon/Dropbox/Development/datasette/datasette/views/table.py"", line 633, in _data_traced
prefix = rows[-2][sort or sort_desc]
IndexError: No item with that key
```
That's this code here: https://github.com/simonw/datasette/blob/7af67b54b7d9bca43e948510fc62f6db2b748fa8/datasette/views/table.py#L631-L645","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1318907685,500 error if sorted by a column not in the ?_col= list,
https://github.com/simonw/datasette/issues/1773#issuecomment-1196166269,https://api.github.com/repos/simonw/datasette/issues/1773,1196166269,IC_kwDOBm6k_c5HTAx9,9599,simonw,2022-07-27T01:26:09Z,2022-07-27T01:26:09Z,OWNER,"So the problem here is that in generating the `?_next=` next page link we need the value from the specified sort column - but we're not selecting it any more.
Possible fixes:
- Always include the sort column in the list of columns that are selected, then filter that out before they are displayed
- Use a second query to figure out the `_sort` or `_sort_desc` value for that last row, since we know its primary key (we always select primary keys)
Not sure which solution is more elegant. I think it might be the second one.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1318907685,500 error if sorted by a column not in the ?_col= list,
https://github.com/simonw/datasette/issues/1773#issuecomment-1196167102,https://api.github.com/repos/simonw/datasette/issues/1773,1196167102,IC_kwDOBm6k_c5HTA--,9599,simonw,2022-07-27T01:28:02Z,2022-07-27T01:28:02Z,OWNER,"So code would look something like this:
```python
try:
prefix = rows[-2][sort or sort_desc]
except KeyError:
# Didn't select sort/sort_desc column - look up value by primary key instead
primary_key = rows[-2][""pk""] # But more complex than this
prefix = (await db.execute(""select * from {table} where pk = ?"", [primary_key])).first_value()
```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1318907685,500 error if sorted by a column not in the ?_col= list,
https://github.com/simonw/sqlite-utils/pull/457#issuecomment-1197090890,https://api.github.com/repos/simonw/sqlite-utils/issues/457,1197090890,IC_kwDOCGYnMM5HWihK,22429695,codecov[bot],2022-07-27T17:40:14Z,2022-07-27T17:40:40Z,NONE,"# [Codecov](https://codecov.io/gh/simonw/sqlite-utils/pull/457?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison) Report
> Merging [#457](https://codecov.io/gh/simonw/sqlite-utils/pull/457?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison) (80b3907) into [main](https://codecov.io/gh/simonw/sqlite-utils/commit/9e6cceac1c0e086429e2d308b700e59cc53a1991?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison) (9e6ccea) will **not change** coverage.
> The diff coverage is `n/a`.
```diff
@@ Coverage Diff @@
## main #457 +/- ##
=======================================
Coverage 96.64% 96.64%
=======================================
Files 6 6
Lines 2566 2566
=======================================
Hits 2480 2480
Misses 86 86
```
------
[Continue to review full report at Codecov](https://codecov.io/gh/simonw/sqlite-utils/pull/457?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison)
> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/simonw/sqlite-utils/pull/457?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison). Last update [9e6ccea...80b3907](https://codecov.io/gh/simonw/sqlite-utils/pull/457?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?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}",1319881016,Link to installation instructions,
https://github.com/simonw/sqlite-utils/pull/457#issuecomment-1197108865,https://api.github.com/repos/simonw/sqlite-utils/issues/457,1197108865,IC_kwDOCGYnMM5HWm6B,9599,simonw,2022-07-27T17:58:10Z,2022-07-27T17:58:10Z,OWNER,Here's the build from the PR: https://sqlite-utils--457.org.readthedocs.build/en/457/,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1319881016,Link to installation instructions,