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/1048#issuecomment-1179758180,https://api.github.com/repos/simonw/datasette/issues/1048,1179758180,IC_kwDOBm6k_c5GUa5k,9599,simonw,2022-07-10T16:23:34Z,2022-07-10T16:23:57Z,OWNER,"But do I need to pass the `use_rowid` boolean here as well, as used by `def path_from_row_pks(row, pks, use_rowid, quote=True)`? Or can I derive that from the fact that `pks` is an empty tuple?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",728905098,Documentation and unit tests for urls.row() urls.row_blob() methods, https://github.com/simonw/datasette/issues/1048#issuecomment-719996693,https://api.github.com/repos/simonw/datasette/issues/1048,719996693,MDEyOklzc3VlQ29tbWVudDcxOTk5NjY5Mw==,9599,simonw,2020-10-31T22:32:09Z,2022-07-10T16:22:48Z,OWNER,"The `row_path` part of these really isn't very user friendly, since you need to properly URL-encode the values. The safest way to do so is by calling this obscure, undocumented utility function: https://github.com/simonw/datasette/blob/f0bd2d05f5f7832df4879822afb99d2096c00d48/datasette/utils/__init__.py#L84-L98 This feels like it should be improved before I turn it into a documented API. (Note that this API deals with a `row` that is a potentially-nested dictionary - not with a `sqlite3.Row` object.)","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",728905098,Documentation and unit tests for urls.row() urls.row_blob() methods, https://github.com/simonw/datasette/issues/1048#issuecomment-1179757912,https://api.github.com/repos/simonw/datasette/issues/1048,1179757912,IC_kwDOBm6k_c5GUa1Y,9599,simonw,2022-07-10T16:21:38Z,2022-07-10T16:21:38Z,OWNER,"I think the best way to do this is to change the method signatures to: ```python def row(self, database, table, row, pks): ... def row_blob(self, database, table, row, pks, column): ... ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",728905098,Documentation and unit tests for urls.row() urls.row_blob() methods, https://github.com/simonw/datasette/issues/1048#issuecomment-1179757605,https://api.github.com/repos/simonw/datasette/issues/1048,1179757605,IC_kwDOBm6k_c5GUawl,9599,simonw,2022-07-10T16:19:42Z,2022-07-10T16:21:03Z,OWNER,"If I do require `pks` to be passed here, maybe I could make those available to the `render_cell()` plugin hook to at least make this a bit more pleasant for plugin authors to use? Current hook: https://docs.datasette.io/en/latest/plugin_hooks.html#render-cell-row-value-column-table-database-datasette https://github.com/simonw/datasette/blob/035dc5e7b95142d4a700819a8cc4ff64aefe4efe/datasette/hookspecs.py#L62-L64 The hook is called in two places in the codebase - when rendering a table (`pks` variable is already in scope here): https://github.com/simonw/datasette/blob/6373bb341457e5becfd5b67792ac2c8b9ed7c384/datasette/views/table.py#L897-L904 And when rendering an arbitrary query: https://github.com/simonw/datasette/blob/6373bb341457e5becfd5b67792ac2c8b9ed7c384/datasette/views/database.py#L377-L384 Note that in that second one `table` is `None` (which is also called out in the documentation) - `pks` would be `None` here too.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",728905098,Documentation and unit tests for urls.row() urls.row_blob() methods, https://github.com/simonw/datasette/issues/1048#issuecomment-1179757067,https://api.github.com/repos/simonw/datasette/issues/1048,1179757067,IC_kwDOBm6k_c5GUaoL,9599,simonw,2022-07-10T16:16:19Z,2022-07-10T16:16:19Z,OWNER,"None of the potential solutions for that problem are particularly appealing: - Make these URL generation methods `async` - should the other ones be `async` too for consistency? - Have some kind of mechanism that calculates and caches the `pks` for each table somewhere which can then be accessed here without an `async` call - Require `pks` is passed to these methods, having been looked up elsewhere. This is a bit gross but may end up being the best solution","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",728905098,Documentation and unit tests for urls.row() urls.row_blob() methods, https://github.com/simonw/datasette/issues/1048#issuecomment-1179756689,https://api.github.com/repos/simonw/datasette/issues/1048,1179756689,IC_kwDOBm6k_c5GUaiR,9599,simonw,2022-07-10T16:14:03Z,2022-07-10T16:14:03Z,OWNER,"I'm considering changing these functions to accept the `row` object itself: ```python def row(self, database, table, row): ... def row_blob(self, database, table, row, column): ... ``` Just one catch: in order to generate the correct `row_path` we need to know the primary keys for that table. We can look those up based on having access to `database` and `table`, but doing so requires an `await ...` operation - and these functions are not `async`.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",728905098,Documentation and unit tests for urls.row() urls.row_blob() methods, https://github.com/simonw/datasette/issues/1048#issuecomment-1179756391,https://api.github.com/repos/simonw/datasette/issues/1048,1179756391,IC_kwDOBm6k_c5GUadn,9599,simonw,2022-07-10T16:12:23Z,2022-07-10T16:12:23Z,OWNER,"Also related: `row` is now available to `render_cell()` hook as-of this issue: - https://github.com/simonw/datasette/issues/1300","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",728905098,Documentation and unit tests for urls.row() urls.row_blob() methods,