{"html_url": "https://github.com/simonw/datasette/issues/541#issuecomment-508872137", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/541", "id": 508872137, "node_id": "MDEyOklzc3VlQ29tbWVudDUwODg3MjEzNw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-07-05T22:16:57Z", "updated_at": "2019-07-05T22:16:57Z", "author_association": "OWNER", "body": "It should allow for awaitables too, to allow for execution of SQL. For example:\r\n\r\n```python\r\n@hookimpl\r\ndef extra_template_vars(datasette):\r\n async def inner():\r\n first_db = list(datasette.databases.keys())[0]\r\n return {\r\n \"sqlite_version\": (\r\n await datasette.execute(first_db, \"select sqlite_version()\")\r\n ).rows[0][0]\r\n }\r\n return inner\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 464779810, "label": "Plugin hook for adding extra template context variables"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/541#issuecomment-508871981", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/541", "id": 508871981, "node_id": "MDEyOklzc3VlQ29tbWVudDUwODg3MTk4MQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-07-05T22:15:35Z", "updated_at": "2019-07-05T22:15:35Z", "author_association": "OWNER", "body": "Example usage:\r\n```python\r\n@hookimpl\r\ndef extra_template_vars(request):\r\n return {\r\n \"auth\": request.scope.get(\"auth\"),\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": 464779810, "label": "Plugin hook for adding extra template context variables"}, "performed_via_github_app": null}