{"html_url": "https://github.com/simonw/datasette/issues/983#issuecomment-754210356", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/983", "id": 754210356, "node_id": "MDEyOklzc3VlQ29tbWVudDc1NDIxMDM1Ng==", "user": {"value": 222245, "label": "carlmjohnson"}, "created_at": "2021-01-04T20:49:05Z", "updated_at": "2021-01-04T20:49:05Z", "author_association": "NONE", "body": "For reasons [I've written about elsewhere](https://blog.carlmjohnson.net/post/2020/time-to-kill-ie11/), I'm in favor of modules. It has several beneficial effects. One, old browsers just ignore it all together. Two, if you include the same plain script on the page more than once, it will be executed twice, but if you include the same module script on a page twice, it will only execute once. Three, you get a module local namespace, instead of having to use the global window namespace or a function private namespace.\r\n\r\nOTOH, if you are going to use an old style script, the code from before isn't ideal, because you wipe out your registry if the script it included more than once. Also you may as well use object methods and splat arguments.\r\n\r\nThe event based architecture probably makes more sense though. Just make up some event names prefixed with `datasette:` and listen for them on the root. The only concern with that approach is it can sometimes be tricky to make sure your plugins are run after datasette has run. Maybe \r\n\r\n```js\r\nfunction mycallback(){\r\n // whatever\r\n}\r\n\r\nif (window.datasette) {\r\n window.datasette.init(mycallback);\r\n} else {\r\n document.addEventListener('datasette:init', mycallback);\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": 712260429, "label": "JavaScript plugin hooks mechanism similar to pluggy"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/782#issuecomment-712569695", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/782", "id": 712569695, "node_id": "MDEyOklzc3VlQ29tbWVudDcxMjU2OTY5NQ==", "user": {"value": 222245, "label": "carlmjohnson"}, "created_at": "2020-10-20T03:45:48Z", "updated_at": "2020-10-20T03:46:14Z", "author_association": "NONE", "body": "I vote against headers. It has a lot of strikes against it: poor discoverability, new developers often don\u2019t know how to use them, makes CORS harder, makes it hard to use eg with JQ, needs ad hoc specification for each bit of metadata, etc. \r\n\r\nThe only advantage of headers is that you don\u2019t need to do .rows, but that\u2019s actually good as a data validation step anyway\u2014if .rows is missing assume there\u2019s an error and do your error handling path instead of parsing the rest.", "reactions": "{\"total_count\": 1, \"+1\": 1, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 627794879, "label": "Redesign default .json format"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/184#issuecomment-494459264", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/184", "id": 494459264, "node_id": "MDEyOklzc3VlQ29tbWVudDQ5NDQ1OTI2NA==", "user": {"value": 222245, "label": "carlmjohnson"}, "created_at": "2019-05-21T16:17:29Z", "updated_at": "2019-05-21T16:17:29Z", "author_association": "NONE", "body": "Reopening this because it still raises 500 for incorrect table capitalization. \r\n\r\nExample:\r\n\r\n- https://salaries.news.baltimoresun.com/salaries/2018+Maryland+state+salaries/1 200 OK\r\n- https://salaries.news.baltimoresun.com/salaries/bad-table/1 400\r\n- https://salaries.news.baltimoresun.com/salaries/2018+maryland+state+salaries/1 500 Internal Error (note lowercase 'm')\r\n\r\nI think because the table name exists but is not in its canonical form, it triggers a dict lookup error.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 292011379, "label": "500 from missing table name"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/pull/426#issuecomment-485557574", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/426", "id": 485557574, "node_id": "MDEyOklzc3VlQ29tbWVudDQ4NTU1NzU3NA==", "user": {"value": 222245, "label": "carlmjohnson"}, "created_at": "2019-04-22T21:23:22Z", "updated_at": "2019-04-22T21:23:22Z", "author_association": "NONE", "body": "Can you cut a new release with this?", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 431756352, "label": "Upgrade to Jinja2==2.10.1"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/227#issuecomment-439194286", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/227", "id": 439194286, "node_id": "MDEyOklzc3VlQ29tbWVudDQzOTE5NDI4Ng==", "user": {"value": 222245, "label": "carlmjohnson"}, "created_at": "2018-11-15T21:20:37Z", "updated_at": "2018-11-15T21:20:37Z", "author_association": "NONE", "body": "I'm diving back into https://salaries.news.baltimoresun.com and what I really want is the ability to inject the request into my context.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 315960272, "label": "prepare_context() plugin hook"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/185#issuecomment-412663658", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/185", "id": 412663658, "node_id": "MDEyOklzc3VlQ29tbWVudDQxMjY2MzY1OA==", "user": {"value": 222245, "label": "carlmjohnson"}, "created_at": "2018-08-13T21:04:11Z", "updated_at": "2018-08-13T21:04:11Z", "author_association": "NONE", "body": "That seems good to me.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 299760684, "label": "Metadata should be a nested arbitrary KV store"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/189#issuecomment-381429213", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/189", "id": 381429213, "node_id": "MDEyOklzc3VlQ29tbWVudDM4MTQyOTIxMw==", "user": {"value": 222245, "label": "carlmjohnson"}, "created_at": "2018-04-15T18:54:22Z", "updated_at": "2018-04-15T18:54:22Z", "author_association": "NONE", "body": "I think I found a bug. I tried to sort by middle initial in my salaries set, and many middle initials are null. The next_url gets set by Datasette to:\r\n\r\nhttp://localhost:8001/salaries-d3a5631/2017+Maryland+state+salaries?_next=None%2C391&_sort=middle_initial\r\n\r\nBut then `None` is interpreted literally and it tries to find a name with the middle initial \"None\" and ends up skipping ahead to O on page 2.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 309471814, "label": "Ability to sort (and paginate) by column"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/189#issuecomment-379791047", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/189", "id": 379791047, "node_id": "MDEyOklzc3VlQ29tbWVudDM3OTc5MTA0Nw==", "user": {"value": 222245, "label": "carlmjohnson"}, "created_at": "2018-04-09T15:23:45Z", "updated_at": "2018-04-09T15:23:45Z", "author_association": "NONE", "body": "Awesome!", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 309471814, "label": "Ability to sort (and paginate) by column"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/184#issuecomment-379788103", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/184", "id": 379788103, "node_id": "MDEyOklzc3VlQ29tbWVudDM3OTc4ODEwMw==", "user": {"value": 222245, "label": "carlmjohnson"}, "created_at": "2018-04-09T15:15:11Z", "updated_at": "2018-04-09T15:15:11Z", "author_association": "NONE", "body": "Visit https://salaries.news.baltimoresun.com/salaries/bad-table.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 292011379, "label": "500 from missing table name"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/193#issuecomment-379142500", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/193", "id": 379142500, "node_id": "MDEyOklzc3VlQ29tbWVudDM3OTE0MjUwMA==", "user": {"value": 222245, "label": "carlmjohnson"}, "created_at": "2018-04-06T04:05:58Z", "updated_at": "2018-04-06T04:05:58Z", "author_association": "NONE", "body": "You could try pulling out a validate query strings method. If it fails validation build the error object from the message. If it passes, you only need to go down a happy path. ", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 310882100, "label": "Cleaner mechanism for handling custom errors"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/185#issuecomment-376614973", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/185", "id": 376614973, "node_id": "MDEyOklzc3VlQ29tbWVudDM3NjYxNDk3Mw==", "user": {"value": 222245, "label": "carlmjohnson"}, "created_at": "2018-03-27T17:49:00Z", "updated_at": "2018-03-27T17:49:00Z", "author_association": "NONE", "body": "@simonw Other than metadata, the biggest item on wishlist for the salaries project was the ability to reorder by column. Of course, that could be done with a custom SQL query, but we didn't want to have to reimplement all the nav/pagination stuff from scratch. \r\n\r\n@carolinp, feel free to add your thoughts.\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 299760684, "label": "Metadata should be a nested arbitrary KV store"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/185#issuecomment-376592044", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/185", "id": 376592044, "node_id": "MDEyOklzc3VlQ29tbWVudDM3NjU5MjA0NA==", "user": {"value": 222245, "label": "carlmjohnson"}, "created_at": "2018-03-27T16:38:23Z", "updated_at": "2018-03-27T16:38:23Z", "author_association": "NONE", "body": "It would be nice to also allow arbitrary keys (maybe under a parent key called params or something to prevent conflicts). For our datasette project, we just have a bunch of dictionaries defined in the base template for things like site URL and column humanized names: https://github.com/baltimore-sun-data/salaries-datasette/blob/master/templates/base.html It would be cleaner if this were in the metadata.json.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 299760684, "label": "Metadata should be a nested arbitrary KV store"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/185#issuecomment-376590265", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/185", "id": 376590265, "node_id": "MDEyOklzc3VlQ29tbWVudDM3NjU5MDI2NQ==", "user": {"value": 222245, "label": "carlmjohnson"}, "created_at": "2018-03-27T16:32:51Z", "updated_at": "2018-03-27T16:32:51Z", "author_association": "NONE", "body": ">I think the templates themselves should be able to indicate if they want the inherited values or not. That way we could support arbitrary key/values and avoid the application code having special knowledge of license_url etc.\r\n\r\nYes, you could have `metadata` that works like `metadata` does currently and `inherited_metadata` that works with inheritance.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 299760684, "label": "Metadata should be a nested arbitrary KV store"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/185#issuecomment-370461231", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/185", "id": 370461231, "node_id": "MDEyOklzc3VlQ29tbWVudDM3MDQ2MTIzMQ==", "user": {"value": 222245, "label": "carlmjohnson"}, "created_at": "2018-03-05T15:43:56Z", "updated_at": "2018-03-05T15:44:27Z", "author_association": "NONE", "body": "Yes. I think the simplest implementation is to change lines like\r\n\r\n```python\r\n metadata = self.ds.metadata.get('databases', {}).get(name, {})\r\n```\r\n\r\nto\r\n\r\n```python\r\nmetadata = {\r\n **self.ds.metadata,\r\n **self.ds.metadata.get('databases', {}).get(name, {}),\r\n}\r\n```\r\n\r\nso that specified inner values overwrite outer values, but only if they exist.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 299760684, "label": "Metadata should be a nested arbitrary KV store"}, "performed_via_github_app": null}