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/916#issuecomment-812941818 | https://api.github.com/repos/simonw/datasette/issues/916 | 812941818 | MDEyOklzc3VlQ29tbWVudDgxMjk0MTgxOA== | 9599 | 2021-04-03T23:43:11Z | 2021-04-03T23:43:11Z | OWNER | Relevant code is some of the most complex in all of Datasette. https://github.com/simonw/datasette/blob/0a7621f96f8ad14da17e7172e8a7bce24ef78966/datasette/views/table.py#L530-L594 And https://github.com/simonw/datasette/blob/0a7621f96f8ad14da17e7172e8a7bce24ef78966/datasette/views/table.py#L743-L771 I'll need to think hard about how to refactor this out into something more understandable before implementing previous links. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
672421411 | |
https://github.com/simonw/datasette/issues/916#issuecomment-812941340 | https://api.github.com/repos/simonw/datasette/issues/916 | 812941340 | MDEyOklzc3VlQ29tbWVudDgxMjk0MTM0MA== | 9599 | 2021-04-03T23:38:37Z | 2021-04-03T23:38:37Z | OWNER | Same query again with `a, d, v` returns 0 results, which is also as we would want: it signifies that we are back to the very first page: https://latest.datasette.io/fixtures?sql=select+pk1%2C+pk2%2C+pk3%2C+content+from+compound_three_primary_keys+where+%28%28pk1+%3C+%3Ap0%29%0D%0A++or%0D%0A%28pk1+%3D+%3Ap0+and+pk2+%3C+%3Ap1%29%0D%0A++or%0D%0A%28pk1+%3D+%3Ap0+and+pk2+%3D+%3Ap1+and+pk3+%3C+%3Ap2%29%29+order+by+pk1+desc%2C+pk2+desc%2C+pk3+desc+limit+1+offset+99&p0=a&p1=d&p2=v | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
672421411 | |
https://github.com/simonw/datasette/issues/916#issuecomment-812941112 | https://api.github.com/repos/simonw/datasette/issues/916 | 812941112 | MDEyOklzc3VlQ29tbWVudDgxMjk0MTExMg== | 9599 | 2021-04-03T23:35:55Z | 2021-04-03T23:35:55Z | OWNER | I tried flipping the direction of the sort and the comparison operators and got this: https://latest.datasette.io/fixtures?sql=select+pk1%2C+pk2%2C+pk3%2C+content+from+compound_three_primary_keys+where+%28%28pk1+%3C+%3Ap0%29%0D%0A++or%0D%0A%28pk1+%3D+%3Ap0+and+pk2+%3C+%3Ap1%29%0D%0A++or%0D%0A%28pk1+%3D+%3Ap0+and+pk2+%3D+%3Ap1+and+pk3+%3C+%3Ap2%29%29+order+by+pk1+desc%2C+pk2+desc%2C+pk3+desc+limit+1+offset+99&p0=a&p1=h&p2=r ```sql select pk1, pk2, pk3, content from compound_three_primary_keys where ((pk1 < :p0) or (pk1 = :p0 and pk2 < :p1) or (pk1 = :p0 and pk2 = :p1 and pk3 < :p2)) order by pk1 desc, pk2 desc, pk3 desc limit 1 offset 99 ``` Which returned `a-d-v` as desired. I messed around with it to find the `limit 1 offset 99` values. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
672421411 | |
https://github.com/simonw/datasette/issues/916#issuecomment-812940907 | https://api.github.com/repos/simonw/datasette/issues/916 | 812940907 | MDEyOklzc3VlQ29tbWVudDgxMjk0MDkwNw== | 9599 | 2021-04-03T23:33:41Z | 2021-04-03T23:33:41Z | OWNER | Let's figure out the SQL for this. The most complex case is probably this one: https://latest.datasette.io/fixtures/compound_three_primary_keys?_next=a%2Ch%2Cr Here's the SQL for that page: https://latest.datasette.io/fixtures?sql=select+pk1%2C+pk2%2C+pk3%2C+content+from+compound_three_primary_keys+where+%28%28pk1+%3E+%3Ap0%29%0A++or%0A%28pk1+%3D+%3Ap0+and+pk2+%3E+%3Ap1%29%0A++or%0A%28pk1+%3D+%3Ap0+and+pk2+%3D+%3Ap1+and+pk3+%3E+%3Ap2%29%29+order+by+pk1%2C+pk2%2C+pk3+limit+101&p0=a&p1=h&p2=r ```sql select pk1, pk2, pk3, content from compound_three_primary_keys where ((pk1 > :p0) or (pk1 = :p0 and pk2 > :p1) or (pk1 = :p0 and pk2 = :p1 and pk3 > :p2)) order by pk1, pk2, pk3 limit 101 ``` Where `p0` is `a`, `p1` is `h` and `p2` is `r`. Given the above, how would I figure out the correct previous link? It should be https://latest.datasette.io/fixtures/compound_three_primary_keys?_next=a%2Cd%2Cv - `a`, `d`, `v`. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
672421411 | |
https://github.com/simonw/datasette/issues/916#issuecomment-812940457 | https://api.github.com/repos/simonw/datasette/issues/916 | 812940457 | MDEyOklzc3VlQ29tbWVudDgxMjk0MDQ1Nw== | 9599 | 2021-04-03T23:28:40Z | 2021-04-03T23:28:40Z | OWNER | I think my ideal implementation for this would be to reverse the order, grab the previous page-size-plus-one items, then return a `?_next=x` token that would provide the previous page sorted back in the expected default order. The alternative would be to have a `?_previous=x` token which can be used to paginate backwards in reverse order, but I think this would be confusing as it would result in "hit next page, then hit previous page" returning you to a new state which features rows in the reverse order. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
672421411 | |
https://github.com/simonw/datasette/issues/1287#issuecomment-812935384 | https://api.github.com/repos/simonw/datasette/issues/1287 | 812935384 | MDEyOklzc3VlQ29tbWVudDgxMjkzNTM4NA== | 9599 | 2021-04-03T22:38:33Z | 2021-04-03T22:38:33Z | OWNER | https://twitter.com/llanga/status/1378431719934681094 looks like I should wait for 3.9.4, out in a few days. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
849396758 | |
https://github.com/simonw/datasette/issues/916#issuecomment-812804998 | https://api.github.com/repos/simonw/datasette/issues/916 | 812804998 | MDEyOklzc3VlQ29tbWVudDgxMjgwNDk5OA== | 9599 | 2021-04-03T03:47:45Z | 2021-04-03T03:47:45Z | OWNER | I found one example of an implementation of reversed keyset pagination here: https://github.com/tvainika/objection-keyset-pagination/blob/cb21a493c96daa6e63c302efae6718d09aa11661/index.js#L74-L79 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
672421411 | |
https://github.com/simonw/datasette/issues/1289#issuecomment-812803256 | https://api.github.com/repos/simonw/datasette/issues/1289 | 812803256 | MDEyOklzc3VlQ29tbWVudDgxMjgwMzI1Ng== | 9599 | 2021-04-03T03:29:25Z | 2021-04-03T03:29:25Z | OWNER | https://github.com/simonw/datasette/actions/runs/713207828 ran with `pytest-xdist` in 4m22s: <img width="1202" alt="Run_tests_in_CI_using_pytest-xdist__refs__1289_·_simonw_datasette_d63fc61" src="https://user-images.githubusercontent.com/9599/113466592-f151bf80-93f1-11eb-9d74-b830e96c19c8.png"> Here's the test suite running on regular `pytest` in 5m13s: <img width="1162" alt="©_2017-2021_·_simonw_datasette_59ef4a2" src="https://user-images.githubusercontent.com/9599/113466606-00387200-93f2-11eb-95a3-24521c628cbe.png"> Not a huge speed-up because there are only 2 available cores in the GitHub Actions environment, but still worthwhile - especially since this lets people run in parallel on their own laptops. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
849543502 | |
https://github.com/simonw/datasette/issues/1289#issuecomment-812768915 | https://api.github.com/repos/simonw/datasette/issues/1289 | 812768915 | MDEyOklzc3VlQ29tbWVudDgxMjc2ODkxNQ== | 9599 | 2021-04-03T00:59:15Z | 2021-04-03T00:59:26Z | OWNER | Looks like `-n auto` only detected two cores on GitHub Actions: https://github.com/simonw/datasette/runs/2257597137?check_suite_focus=true ``` ============================= test session starts ============================== platform linux -- Python 3.7.10, pytest-6.2.2, py-1.10.0, pluggy-0.13.1 SQLite: 3.31.1 rootdir: /home/runner/work/datasette/datasette, configfile: pytest.ini plugins: xdist-2.2.1, timeout-1.4.2, forked-1.3.0, asyncio-0.14.0 gw0 I / gw1 I gw0 [878] / gw1 [878] ``` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
849543502 | |
https://github.com/simonw/datasette/issues/1289#issuecomment-812767460 | https://api.github.com/repos/simonw/datasette/issues/1289 | 812767460 | MDEyOklzc3VlQ29tbWVudDgxMjc2NzQ2MA== | 9599 | 2021-04-03T00:48:26Z | 2021-04-03T00:48:26Z | OWNER | On my Mac `pytest-xdist` ran the test suite (minus two tests) in 59s, as opposed to 2m23s without xdist. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
849543502 |