{"url":"https://api.github.com/repos/simonw/sqlite-utils/issues/573","repository_url":"https://api.github.com/repos/simonw/sqlite-utils","labels_url":"https://api.github.com/repos/simonw/sqlite-utils/issues/573/labels{/name}","comments_url":"https://api.github.com/repos/simonw/sqlite-utils/issues/573/comments","events_url":"https://api.github.com/repos/simonw/sqlite-utils/issues/573/events","html_url":"https://github.com/simonw/sqlite-utils/pull/573","id":1816917522,"node_id":"PR_kwDOCGYnMM5WJ6Jm","number":573,"title":"feat: Implement a prepare_connection plugin hook","user":{"login":"asg017","id":15178711,"node_id":"MDQ6VXNlcjE1MTc4NzEx","avatar_url":"https://avatars.githubusercontent.com/u/15178711?v=4","gravatar_id":"","url":"https://api.github.com/users/asg017","html_url":"https://github.com/asg017","followers_url":"https://api.github.com/users/asg017/followers","following_url":"https://api.github.com/users/asg017/following{/other_user}","gists_url":"https://api.github.com/users/asg017/gists{/gist_id}","starred_url":"https://api.github.com/users/asg017/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asg017/subscriptions","organizations_url":"https://api.github.com/users/asg017/orgs","repos_url":"https://api.github.com/users/asg017/repos","events_url":"https://api.github.com/users/asg017/events{/privacy}","received_events_url":"https://api.github.com/users/asg017/received_events","type":"User","user_view_type":"public","site_admin":false},"labels":[],"state":"closed","locked":false,"assignees":[],"milestone":null,"comments":4,"created_at":"2023-07-22T22:48:44Z","updated_at":"2023-07-22T22:59:09Z","closed_at":"2023-07-22T22:59:09Z","assignee":null,"author_association":"CONTRIBUTOR","active_lock_reason":null,"draft":false,"pull_request":{"url":"https://api.github.com/repos/simonw/sqlite-utils/pulls/573","html_url":"https://github.com/simonw/sqlite-utils/pull/573","diff_url":"https://github.com/simonw/sqlite-utils/pull/573.diff","patch_url":"https://github.com/simonw/sqlite-utils/pull/573.patch","merged_at":"2023-07-22T22:59:09Z"},"body":"Just like the [Datasette prepare_connection hook](https://docs.datasette.io/en/stable/plugin_hooks.html#prepare-connection-conn-database-datasette), this PR adds a similar hook for the `sqlite-utils` plugin system. \r\n\r\nThe sole argument is `conn`, since I don't believe a `database` or `datasette` argument would be relevant here. \r\n\r\nI want to do this so I can release `sqlite-utils` plugins for my [SQLite extensions](https://github.com/asg017/sqlite-ecosystem), similar to the Datasette plugins I've release for them. \r\n\r\nAn example plugin: https://gist.github.com/asg017/d7cdf0d56e2be87efda28cebee27fa3c\r\n\r\n```bash\r\n$ sqlite-utils install https://gist.github.com/asg017/d7cdf0d56e2be87efda28cebee27fa3c/archive/5f5ad549a40860787629c69ca120a08c32519e99.zip\r\n\r\n$ sqlite-utils memory 'select hello(\"alex\") as response'\r\n[{\"response\": \"Hello, alex!\"}]\r\n```\r\nRefs:\r\n- #574 \r\n\r\n<!-- readthedocs-preview sqlite-utils start -->\r\n----\r\n:books: Documentation preview :books:: https://sqlite-utils--573.org.readthedocs.build/en/573/\r\n\r\n<!-- readthedocs-preview sqlite-utils end -->","closed_by":{"login":"simonw","id":9599,"node_id":"MDQ6VXNlcjk1OTk=","avatar_url":"https://avatars.githubusercontent.com/u/9599?v=4","gravatar_id":"","url":"https://api.github.com/users/simonw","html_url":"https://github.com/simonw","followers_url":"https://api.github.com/users/simonw/followers","following_url":"https://api.github.com/users/simonw/following{/other_user}","gists_url":"https://api.github.com/users/simonw/gists{/gist_id}","starred_url":"https://api.github.com/users/simonw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonw/subscriptions","organizations_url":"https://api.github.com/users/simonw/orgs","repos_url":"https://api.github.com/users/simonw/repos","events_url":"https://api.github.com/users/simonw/events{/privacy}","received_events_url":"https://api.github.com/users/simonw/received_events","type":"User","user_view_type":"public","site_admin":false},"reactions":{"url":"https://api.github.com/repos/simonw/sqlite-utils/issues/573/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0},"timeline_url":"https://api.github.com/repos/simonw/sqlite-utils/issues/573/timeline","performed_via_github_app":null,"state_reason":null}