{"id":51790645,"url":"https://github.com/calf-ai/ksqlite","last_synced_at":"2026-07-20T22:02:18.595Z","repository":{"id":371443951,"uuid":"1298739727","full_name":"calf-ai/ksqlite","owner":"calf-ai","description":"A distributed SQLite store built on Kafka.","archived":false,"fork":false,"pushed_at":"2026-07-15T03:11:25.000Z","size":410,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-15T03:34:04.634Z","etag":null,"topics":["distributed-database","edge-deployment","kafka","sqlite"],"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/calf-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-07-13T01:10:01.000Z","updated_at":"2026-07-15T03:05:34.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/calf-ai/ksqlite","commit_stats":null,"previous_names":["calf-ai/ksqlite"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/calf-ai/ksqlite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calf-ai%2Fksqlite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calf-ai%2Fksqlite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calf-ai%2Fksqlite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calf-ai%2Fksqlite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/calf-ai","download_url":"https://codeload.github.com/calf-ai/ksqlite/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calf-ai%2Fksqlite/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35700998,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"ssl_error","status_checked_at":"2026-07-20T02:08:09.736Z","response_time":111,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["distributed-database","edge-deployment","kafka","sqlite"],"created_at":"2026-07-20T22:02:17.400Z","updated_at":"2026-07-20T22:02:18.561Z","avatar_url":"https://github.com/calf-ai.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KSQLite\n\n[![PyPI](https://img.shields.io/pypi/v/ksqlite-py)](https://pypi.org/project/ksqlite-py/)\n[![Coverage](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/calf-ai/ksqlite/python-coverage-comment-action-data/endpoint.json)](https://github.com/calf-ai/ksqlite/tree/python-coverage-comment-action-data)\n[![Python versions](https://img.shields.io/pypi/pyversions/ksqlite-py)](https://pypi.org/project/ksqlite-py/)\n[![License: MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE)\n\n*Turn SQLite into a distributed, durable store: millisecond-local SQL on every\ninstance, with Kafka holding the data and rehydrating it on demand.*\n\nKSQLite gives each instance of your app a fast, local SQLite database of the\nshards it owns — durable on disk and queryable with plain SQL. Kafka is the\ndistribution and recovery layer: a per-shard **changelog** carries every write\nand lives on the network, so a new or replacement instance rehydrates its local\nSQLite by replaying that changelog. Your data isn't pinned to one box — it\nfollows ownership across the fleet.\n\nKSQLite is an embeddable library, not a service. Use it two ways:\n\n- **Attached to a Kafka consumer.** You keep your own consumer and hook KSQLite\n  into its rebalance listener; local state follows partition ownership\n  automatically.\n- **Standalone.** No consumer at all. You claim shards yourself and get durable\n  local SQL storage that any instance can rebuild — Kafka is deployed to hold\n  the data, not to feed it.\n\nA **shard** is one unit of ownership: a single `(topic, partition)`, backed by\none changelog topic. The API spells it `TopicPartition`. When you consume a\ntopic, a shard is one of its partitions; when you don't, it's just a name you\nchose.\n\n## Requirements\n\n- Python \u003e= 3.10\n- SQLite \u003e= 3.38 (otherwise, see [How to run on an older SQLite](docs/how-to/run-on-older-sqlite.md))\n- A Kafka-compatible broker\n\n## Install\n\n```sh\nuv add ksqlite-py\n```\n\n## Quickstart\n\n```python\nimport asyncio\n\nfrom aiokafka import TopicPartition\n\nfrom ksqlite import GeneratedColumn, Index, KSQLite\n\nSHARD = TopicPartition(\"messages\", 0)\n\n\nasync def main() -\u003e None:\n    async with KSQLite(\n        db_path=\"state.db\",\n        bootstrap_servers=\"localhost:9092\",\n        generated_columns=[GeneratedColumn(\"thread_id\", \"$.thread_id\")],\n        indexes=[Index(\"ix_thread\", [\"thread_id\"])],\n        create_topics_retention_ms=-1,  # dev convenience; ops pre-creates in prod\n    ) as store:\n        # Claim the shard: creates the changelog if needed, replays it, and\n        # makes its rows visible. A consumer app calls this from its rebalance\n        # listener instead.\n        await store.on_partitions_assigned([SHARD])\n\n        await store.append(\n            source=SHARD,\n            entity_key=\"th-42\",\n            payload={\"thread_id\": \"th-42\", \"text\": \"hello\"},\n        )\n\n        rows = await store.query(\n            \"SELECT payload FROM records WHERE thread_id = ?\", [\"th-42\"]\n        )\n        print([row[\"payload\"] for row in rows])\n\n\nasyncio.run(main())\n```\n\nDelete `state.db` and run it again — the row from the previous run is still\nthere, replayed from the changelog before the new append. (You get one more row\neach run: `append()` is append-only, so it inserts rather than overwriting.)\n\nFor the same thing at a walking pace, see the\n[tutorial](docs/tutorial/build-a-local-store.md).\n\n## Documentation\n\nTutorial, how-to guides, reference, and explanation live in\n[docs/](docs/README.md).\n\n## Development\n\n```sh\nuv sync\nuv run pytest                      # unit + integration (fakes, real SQLite)\nuv run pytest -m e2e               # real-broker suite (needs Docker)\nuv run ruff check \u0026\u0026 uv run ruff format --check \u0026\u0026 uv run mypy\n```\n\nThe end-to-end suite runs against a pinned Redpanda container\n(`docker.redpanda.com/redpandadata/redpanda:v24.2.20`) and auto-skips when\nDocker is unavailable.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE)\nfile for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalf-ai%2Fksqlite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcalf-ai%2Fksqlite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalf-ai%2Fksqlite/lists"}