{"html_url": "https://github.com/simonw/datasette/pull/2121#issuecomment-1653666188", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/2121", "id": 1653666188, "node_id": "IC_kwDOBm6k_c5ikPGM", "user": {"value": 22429695, "label": "codecov[bot]"}, "created_at": "2023-07-27T13:48:43Z", "updated_at": "2023-07-27T13:48:43Z", "author_association": "NONE", "body": "## [Codecov](https://app.codecov.io/gh/simonw/datasette/pull/2121?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison) Report\nPatch and project coverage have no change.\n> Comparison is base [(`0818182`)](https://app.codecov.io/gh/simonw/datasette/commit/08181823990a71ffa5a1b57b37259198eaa43e06?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison) 92.38% compared to head [(`3aca01f`)](https://app.codecov.io/gh/simonw/datasette/pull/2121?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison) 92.38%.\n\n
Additional details and impacted files\n\n\n```diff\n@@ Coverage Diff @@\n## main #2121 +/- ##\n=======================================\n Coverage 92.38% 92.38% \n=======================================\n Files 39 39 \n Lines 5803 5803 \n=======================================\n Hits 5361 5361 \n Misses 442 442 \n```\n\n\n\n\n
\n\n[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/simonw/datasette/pull/2121?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison). \n:loudspeaker: Have feedback on the report? [Share it here](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).\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1824399610, "label": "Bump furo from 2023.3.27 to 2023.7.26"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/pull/2077#issuecomment-1653652665", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/2077", "id": 1653652665, "node_id": "IC_kwDOBm6k_c5ikLy5", "user": {"value": 49699333, "label": "dependabot[bot]"}, "created_at": "2023-07-27T13:40:52Z", "updated_at": "2023-07-27T13:40:52Z", "author_association": "CONTRIBUTOR", "body": "Superseded by #2121.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1719759468, "label": "Bump furo from 2023.3.27 to 2023.5.20"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/2112#issuecomment-1652751140", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/2112", "id": 1652751140, "node_id": "IC_kwDOBm6k_c5igvsk", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-07-27T00:52:53Z", "updated_at": "2023-07-27T00:52:53Z", "author_association": "OWNER", "body": "Maybe I teach `datasette.render_template()` to take a dataclass instance as an optional alternative to a dictionary, and if it gets one it turns it into something that works well in the template context.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1822938661, "label": "Build HTML version of /content?sql=..."}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/2112#issuecomment-1652746185", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/2112", "id": 1652746185, "node_id": "IC_kwDOBm6k_c5igufJ", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-07-27T00:46:37Z", "updated_at": "2023-07-27T00:46:37Z", "author_association": "OWNER", "body": "Got Claude to generate this code:\r\n```python\r\nfrom dataclasses import dataclass, field\r\n\r\n@dataclass\r\nclass QueryContext:\r\n database: str = field(metadata={\"help\": \"The name of the database being queried\"})\r\n query: dict = field(metadata={\"help\": \"The SQL query object containing the `sql` string\"})\r\n canned_query: str = field(metadata={\"help\": \"The name of the canned query if this is a canned query\"})\r\n private: bool = field(metadata={\"help\": \"Boolean indicating if this is a private database\"})\r\n urls: dict = field(metadata={\"help\": \"Object containing URL helpers like `database()`\"})\r\n canned_write: bool = field(metadata={\"help\": \"Boolean indicating if this canned query allows writes\"})\r\n db_is_immutable: bool = field(metadata={\"help\": \"Boolean indicating if this database is immutable\"})\r\n error: str = field(metadata={\"help\": \"Any query error message\"})\r\n hide_sql: bool = field(metadata={\"help\": \"Boolean indicating if the SQL should be hidden\"})\r\n show_hide_link: str = field(metadata={\"help\": \"The URL to toggle showing/hiding the SQL\"})\r\n show_hide_text: str = field(metadata={\"help\": \"The text for the show/hide SQL link\"})\r\n editable: bool = field(metadata={\"help\": \"Boolean indicating if the SQL can be edited\"})\r\n allow_execute_sql: bool = field(metadata={\"help\": \"Boolean indicating if custom SQL can be executed\"})\r\n tables: list = field(metadata={\"help\": \"List of table objects in the database\"})\r\n named_parameter_values: dict = field(metadata={\"help\": \"Dictionary of parameter names/values\"})\r\n csrftoken: callable = field(metadata={\"help\": \"Function to generate a CSRF token\"})\r\n edit_sql_url: str = field(metadata={\"help\": \"URL to edit the SQL for a canned query\"})\r\n display_rows: list = field(metadata={\"help\": \"List of result rows to display\"})\r\n columns: list = field(metadata={\"help\": \"List of column names\"})\r\n renderers: dict = field(metadata={\"help\": \"Dictionary of renderer name to URL\"})\r\n url_csv: str = field(metadata={\"help\": \"URL for CSV export\"})\r\n metadata: dict = field(metadata={\"help\": \"Metadata about the query/database\"})\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1822938661, "label": "Build HTML version of /content?sql=..."}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/2112#issuecomment-1652723029", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/2112", "id": 1652723029, "node_id": "IC_kwDOBm6k_c5igo1V", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-07-27T00:25:49Z", "updated_at": "2023-07-27T00:25:49Z", "author_association": "OWNER", "body": "Getting the query page working with all of the necessary HTML context variables is a slog.\r\n\r\nI uploaded `query.html` to Claude and asked it \"List of every template context variable with a detailed description of each one\":\r\n\r\n\"image\"\r\n\r\n> Based on the template code provided, here is a list of the template context variables and a description of each one:\r\n> \r\n> - `database` - The name of the database being queried.\r\n> - `query` - The SQL query object containing the `sql` string.\r\n> - `canned_query` - The name of the canned query if this is a canned query. \r\n> - `private` - Boolean indicating if this is a private database.\r\n> - `urls` - Object containing URL helpers like `database()`.\r\n> - `canned_write` - Boolean indicating if this canned query allows writes.\r\n> - `db_is_immutable` - Boolean indicating if this database is immutable. \r\n> - `error` - Any query error message.\r\n> - `hide_sql` - Boolean indicating if the SQL should be hidden. \r\n> - `show_hide_link` - The URL to toggle showing/hiding the SQL.\r\n> - `show_hide_text` - The text for the show/hide SQL link. \r\n> - `editable` - Boolean indicating if the SQL can be edited.\r\n> - `allow_execute_sql` - Boolean indicating if custom SQL can be executed.\r\n> - `tables` - List of table objects in the database.\r\n> - `named_parameter_values` - Dictionary of parameter names/values.\r\n> - `csrftoken()` - Function to generate a CSRF token.\r\n> - `edit_sql_url` - URL to edit the SQL for a canned query.\r\n> - `display_rows` - List of result rows to display.\r\n> - `columns` - List of column names. \r\n> - `renderers` - Dictionary of renderer name to URL.\r\n> - `url_csv` - URL for CSV export.\r\n> - `metadata` - Metadata about the query/database.\r\n> - `crumbs` - Breadcrumb navigation object.\r\n> \r\n> So in summary, it includes variables for the database, query, results, URLs, permissions, and metadata to power the template.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1822938661, "label": "Build HTML version of /content?sql=..."}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/2112#issuecomment-1652722208", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/2112", "id": 1652722208, "node_id": "IC_kwDOBm6k_c5igoog", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-07-27T00:24:50Z", "updated_at": "2023-07-27T00:25:16Z", "author_association": "OWNER", "body": "I changed my mind, I'm not going to do this with a format hook.\r\n\r\nAlso: https://github.com/simonw/datasette/issues/2109#issuecomment-1652715823\r\n\r\nI've decided to let HTML have its own special context. I'm going to try formalizing that as a `@dataclass` with fields with `metadata={\"help\": ...}` to see what that looks like.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1822938661, "label": "Build HTML version of /content?sql=..."}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/2109#issuecomment-1652721111", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/2109", "id": 1652721111, "node_id": "IC_kwDOBm6k_c5igoXX", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-07-27T00:23:28Z", "updated_at": "2023-07-27T00:23:37Z", "author_association": "OWNER", "body": "Once again I'm tempted to formalize the extra HTML context as a `dataclass` so I can ensure it is documented correctly.\r\n\r\nHere's an example of Hugging Face doing that: https://github.com/huggingface/transformers/blob/1689aea73346816b936b84932e12b774974e61a6/src/transformers/training_args.py#L622C1-L624\r\n\r\n```python\r\nfrom dataclasses import dataclass, field\r\n\r\n@dataclass\r\nclass TrainingArguments:\r\n output_dir: str = field(\r\n metadata={\"help\": \"The output directory where the model predictions and checkpoints will be written.\"},\r\n )\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1822934563, "label": "Plan for getting the new JSON format query views working"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/2109#issuecomment-1652715823", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/2109", "id": 1652715823, "node_id": "IC_kwDOBm6k_c5ignEv", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-07-27T00:17:04Z", "updated_at": "2023-07-27T00:18:07Z", "author_association": "OWNER", "body": "New decision: I had originally decided that the HTML view would just use data that could otherwise be extracted from the JSON view if you fed in enough extras.\r\n\r\nI've changed my mind. I'm OK with the HTML view getting a few bonus things available in its context, provided those are clearly documented for template authors.\r\n\r\nThis should help avoid me having to make many changes to the templates themselves.\r\n\r\nHTML-specific stuff will be things like `csrftoken()` and `edit_sql_url` and `show_hide_link` and `database_color` and suchlike.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1822934563, "label": "Plan for getting the new JSON format query views working"}, "performed_via_github_app": null}