{"html_url": "https://github.com/simonw/datasette/issues/2143#issuecomment-1685259985", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/2143", "id": 1685259985, "node_id": "IC_kwDOBm6k_c5kcwbR", "user": {"value": 11784304, "label": "dvizard"}, "created_at": "2023-08-20T11:27:21Z", "updated_at": "2023-08-20T11:27:21Z", "author_association": "NONE", "body": "To chime in from a poweruser perspective: I'm worried that this is an overengineering trap. Yes, the current solution is somewhat messy. But there are datasette-wide settings, there are database-scope settings, there are table-scope settings etc, but then there are database-scope metadata and table-scope metadata. Trying to cleanly separate \"settings\" from \"configuration\" is, I believe, an uphill fight. Even separating db/table-scope settings from pure descriptive metadata is not always easy. Like, do canned queries belong to database metadata or to settings? Do I need two separate files for this?\r\n\r\nOne pragmatic solution I used in a project is stacking yaml configuration files. Basically, have an arbitrary number of yaml or json settings files that you load in a specified order. Every file adds to the corresponding settings in the earlier-loaded file (if it already existed). I implemented this myself but found later that there is an existing Python \"cascading dict\" type of thing, I forget what it's called. There is a bit of a challenge deciding whether there is \"replacement\" or \"addition\" (I think I pragmatically ran `update` on the second level of the dict but better solutions are certainly possible). \r\n\r\nThis way, one allows separation of settings into different blocks, while not imposing a specific idea of what belongs where that might not apply equally to all cases.\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1855885427, "label": "De-tangling Metadata before Datasette 1.0"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/2143#issuecomment-1685260244", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/2143", "id": 1685260244, "node_id": "IC_kwDOBm6k_c5kcwfU", "user": {"value": 11784304, "label": "dvizard"}, "created_at": "2023-08-20T11:29:00Z", "updated_at": "2023-08-20T11:29:00Z", "author_association": "NONE", "body": "https://docs.python.org/3/library/collections.html#collections.ChainMap", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1855885427, "label": "De-tangling Metadata before Datasette 1.0"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/2143#issuecomment-1685260624", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/2143", "id": 1685260624, "node_id": "IC_kwDOBm6k_c5kcwlQ", "user": {"value": 11784304, "label": "dvizard"}, "created_at": "2023-08-20T11:31:16Z", "updated_at": "2023-08-20T11:31:16Z", "author_association": "NONE", "body": "https://pypi.org/project/deep-chainmap/", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1855885427, "label": "De-tangling Metadata before Datasette 1.0"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/2143#issuecomment-1685263948", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/2143", "id": 1685263948, "node_id": "IC_kwDOBm6k_c5kcxZM", "user": {"value": 11784304, "label": "dvizard"}, "created_at": "2023-08-20T11:50:10Z", "updated_at": "2023-08-20T11:50:10Z", "author_association": "NONE", "body": "This also makes it simple to separate out secrets.\r\n\r\n`datasette --config settings.yaml --config secrets.yaml --config db-docs.yaml --config db-fixtures.yaml`\r\n\r\nsettings.yaml\r\n```\r\nsettings:\r\n default_page_size: 10\r\n max_returned_rows: 3000\r\n sql_time_limit_ms\": 8000\r\nplugins:\r\n datasette-ripgrep:\r\n path: /usr/local/lib/python3.11/site-packages\r\n```\r\n\r\nsecrets.yaml\r\n```\r\nplugins:\r\n datasette-auth-github:\r\n client_secret: SUCH_SECRET \r\n```\r\n\r\n\r\ndb-docs.yaml\r\n```\r\ndatabases:\r\n docs:\r\n permissions:\r\n create-table:\r\n id: editor\r\n```\r\n\r\ndb-fixtures.yaml\r\n```\r\ndatabases:\r\n fixtures:\r\n tables:\r\n no_primary_key:\r\n hidden: true\r\n queries:\r\n neighborhood_search:\r\n sql: |-\r\n select neighborhood, facet_cities.name, state\r\n from facetable join facet_cities on facetable.city_id = facet_cities.id\r\n where neighborhood like '%' || :text || '%' order by neighborhood;\r\n title: Search neighborhoods\r\n description_html: |-\r\n

This demonstrates basic LIKE search\r\n```", "reactions": "{\"total_count\": 1, \"+1\": 1, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1855885427, "label": "De-tangling Metadata before Datasette 1.0"}, "performed_via_github_app": null}