github
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/issues/189#issuecomment-377459579 | https://api.github.com/repos/simonw/datasette/issues/189 | 377459579 | MDEyOklzc3VlQ29tbWVudDM3NzQ1OTU3OQ== | 9599 | 2018-03-30T06:47:52Z | 2018-03-30T06:47:52Z | OWNER | I'm not entirely sure how to get `_next=` pagination working against sorted collections when a tie-breaker is needed. Consider this data: https://fivethirtyeight.datasettes.com/fivethirtyeight-2628db9?sql=select+rowid%2C+*+from+%5Bnfl-wide-receivers%2Fadvanced-historical%5D%0D%0Aorder+by+case+when+career_ranypa+is+null+then+1+else+0+end%2C+career_ranypa%2C+rowid+limit+11 ![2018-03-29 at 11 46 pm](https://user-images.githubusercontent.com/9599/38127549-790c8bd0-33ab-11e8-8d32-66f5d3847c8a.png) If the page size was set to 9 rather than 11, the page divide would be between those two rows with the same value in the `career_ranypa` column. What would the `?_next=` token look like such that the correct row would be returned? | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
309471814 | |
https://github.com/simonw/datasette/issues/189#issuecomment-377460127 | https://api.github.com/repos/simonw/datasette/issues/189 | 377460127 | MDEyOklzc3VlQ29tbWVudDM3NzQ2MDEyNw== | 9599 | 2018-03-30T06:51:29Z | 2018-03-30T06:51:52Z | OWNER | The problem is that our `_next=` pagination currently works based on a `>` - but for this case a `>=` for the value is needed combined with a `>` on the tie-breaker (which would be the `rowid` column). So I think this is the right SQL: ``` select rowid, * from [nfl-wide-receivers/advanced-historical] where career_ranypa >= -6.331167749 and rowid > 2736 order by case when career_ranypa is null then 1 else 0 end, career_ranypa, rowid limit 11 ``` https://fivethirtyeight.datasettes.com/fivethirtyeight-2628db9?sql=select+rowid%2C+*+from+%5Bnfl-wide-receivers%2Fadvanced-historical%5D%0D%0Awhere+career_ranypa+%3E%3D+-6.331167749+and+rowid+%3E+2736%0D%0Aorder+by+case+when+career_ranypa+is+null+then+1+else+0+end%2C+career_ranypa%2C+rowid+limit+11 But how do I encode a `_next` token that means ">= X and > Y"? | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
309471814 | |
https://github.com/simonw/datasette/issues/189#issuecomment-377462334 | https://api.github.com/repos/simonw/datasette/issues/189 | 377462334 | MDEyOklzc3VlQ29tbWVudDM3NzQ2MjMzNA== | 9599 | 2018-03-30T07:06:21Z | 2018-03-30T07:06:21Z | OWNER | Maybe the answer here is that anything that's encoded in the next token is treated as >= with the exception of columns known to be primary keys, which are treated as > | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
309471814 | |
https://github.com/simonw/datasette/issues/189#issuecomment-377546510 | https://api.github.com/repos/simonw/datasette/issues/189 | 377546510 | MDEyOklzc3VlQ29tbWVudDM3NzU0NjUxMA== | 9599 | 2018-03-30T15:13:11Z | 2018-03-30T15:13:11Z | OWNER | Pushed some work-in-progress with failing unit tests here: https://github.com/simonw/datasette/commit/2f8359c6f25768805431c80c74e5ec4213c2b2a6 Here's a demo: https://datasette-column-sort-wip.now.sh/sortable-4bbaa6f/sortable?_sort=sortable - note that the `_sort_desc` and `_sort_nulls_last` options aren't done yet, plus it doesn't correctly paginate (the `_next` tokens do not yet take sorting into account). | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
309471814 | |
https://github.com/simonw/datasette/issues/189#issuecomment-377547265 | https://api.github.com/repos/simonw/datasette/issues/189 | 377547265 | MDEyOklzc3VlQ29tbWVudDM3NzU0NzI2NQ== | 9599 | 2018-03-30T15:16:43Z | 2018-03-30T15:16:43Z | OWNER | I think this is the right incantation for a "next" link: https://datasette-column-sort-wip.now.sh/sortable-4bbaa6f?sql=select+*+from+sortable%0D%0Awhere+sortable+%3C%3D+94%0D%0Aand+%28%0D%0A++%28pk1+%3E+%27d%27%29%0D%0A++or%0D%0A++%28pk1+%3D+%27d%27+and+pk2+%3E+%27w%27%29%0D%0A%29%0D%0Aorder+by+sortable+desc%2C+pk1%2C+pk2%0D%0Alimit+7 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
309471814 |