{"id":23629645,"url":"https://github.com/merlinz01/anysqlite3","last_synced_at":"2026-02-09T12:36:20.368Z","repository":{"id":269628599,"uuid":"908041409","full_name":"merlinz01/anysqlite3","owner":"merlinz01","description":"An async wrapper for the sqlite3 module compatible with both asyncio and trio.","archived":false,"fork":false,"pushed_at":"2024-12-25T00:46:45.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T22:15:31.513Z","etag":null,"topics":["anyio","asyncio","python","sqlite","trio"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/merlinz01.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-25T00:42:16.000Z","updated_at":"2024-12-25T00:43:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"153a14ae-0210-49ea-86f1-e57a8ee98d71","html_url":"https://github.com/merlinz01/anysqlite3","commit_stats":null,"previous_names":["merlinz01/anysqlite3"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merlinz01%2Fanysqlite3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merlinz01%2Fanysqlite3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merlinz01%2Fanysqlite3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merlinz01%2Fanysqlite3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/merlinz01","download_url":"https://codeload.github.com/merlinz01/anysqlite3/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248119289,"owners_count":21050755,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anyio","asyncio","python","sqlite","trio"],"created_at":"2024-12-28T01:16:32.194Z","updated_at":"2026-02-09T12:36:20.274Z","avatar_url":"https://github.com/merlinz01.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# anysqlite3\n\n**anysqlite3** is a wrapper around `sqlite3` that allows you to interact with SQLite databases from async code.\nIt is built on top of the built-in `sqlite3` module and is compatible with both `asyncio` and `trio` code.\n\n## Installation\n\n```bash\npip install anysqlite3\n```\n\n## Usage\n\n**anysqlite3** provides essentially the same API as the built-in `sqlite3` module, but with async versions of most methods.\n\n```python\nimport anyio # or asyncio or trio\nimport anysqlite3\n\nasync def main():\n    async with await anysqlite3.connect(\":memory:\") as db:\n        await db.execute(\"CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)\")\n        await db.execute(\"INSERT INTO users (name) VALUES (?)\", (\"Alice\",))\n        await db.execute(\"INSERT INTO users (name) VALUES (?)\", (\"Bob\",))\n\n        async for row in db.execute(\"SELECT * FROM users\"):\n            print(row)\n\nanyio.run(main())\n```\n\n### Transactions\n\n**anysqlite3** provides a context manager for transactions.\nUse this instead of the database's `commit` and `rollback` methods.\nTransactions hold a lock on the database, so you should always use them in a `with` block.\n\n```python\nasync with db.transaction() as t:\n    await db.execute(\"INSERT INTO users (name) VALUES (?)\", (\"Charlie\",))\n    await t.rollback()\n    await db.execute(\"INSERT INTO users (name) VALUES (?)\", (\"David\",))\n    await t.commit() # Optional, as the transaction will commit automatically the with block exits without an exception\n```\n\n## License\n\nThis project is licensed under the MIT License - see [LICENSE.txt](LICENSE.txt) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmerlinz01%2Fanysqlite3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmerlinz01%2Fanysqlite3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmerlinz01%2Fanysqlite3/lists"}