{"id":27012137,"url":"https://github.com/renanmoretto/keyv","last_synced_at":"2026-03-10T22:04:00.803Z","repository":{"id":250211473,"uuid":"833808919","full_name":"renanmoretto/keyv","owner":"renanmoretto","description":"Transform SQLite into a powerful and fast key-value store.","archived":false,"fork":false,"pushed_at":"2025-05-20T13:45:53.000Z","size":105,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-07T13:55:22.058Z","etag":null,"topics":["database","key-value","nosql","nosql-database","sqlite","sqlite3"],"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/renanmoretto.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}},"created_at":"2024-07-25T19:46:30.000Z","updated_at":"2025-05-20T13:45:57.000Z","dependencies_parsed_at":"2024-07-25T22:44:30.041Z","dependency_job_id":"e93647c2-64be-4a29-9fe3-7e3ad389049e","html_url":"https://github.com/renanmoretto/keyv","commit_stats":null,"previous_names":["renanmoretto/nosqueel","renanmoretto/keyv"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/renanmoretto/keyv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renanmoretto%2Fkeyv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renanmoretto%2Fkeyv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renanmoretto%2Fkeyv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renanmoretto%2Fkeyv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/renanmoretto","download_url":"https://codeload.github.com/renanmoretto/keyv/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renanmoretto%2Fkeyv/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30357614,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T21:41:54.280Z","status":"ssl_error","status_checked_at":"2026-03-10T21:40:59.357Z","response_time":106,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["database","key-value","nosql","nosql-database","sqlite","sqlite3"],"created_at":"2025-04-04T11:47:55.798Z","updated_at":"2026-03-10T22:04:00.798Z","avatar_url":"https://github.com/renanmoretto.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# keyv\n\nTransform SQLite into a powerful and fast key-value store.\n\n`keyv` is a lightweight library that turns SQLite into a NoSQL key-value database, combining the best of both worlds: the simplicity of key-value stores with the reliability of SQLite. Perfect for applications that need a robust local database without the complexity of a full DBMS.\n\n# Quick Start\n\nFor simple use cases, you can create a default collection right away:\n```bash\npip install keyv\n```\n```python\nimport keyv\n\n# Create a database with a default collection\ndb = keyv.connect('keyv.db').collection('main')\n\n# Now you can use the collection methods directly\ndb.set('key1', 'value1')\ndb.get('key1')\n# \u003e\u003e\u003e 'value1'\n```\n\n# Usage\n\n```python\nimport keyv\n\n# initialize the database\ndb = keyv.connect('keyv.db') # or .anything, since is sqlite3 engine, you can choose any\n\n# create or get a collection\ncollection = db.collection('my_collection')\n\n# insert a key-value pair\ncollection.set('key1', 'value1')\n\n# by default the .set method will replace existing values\n# if you want to prevent overwriting existing keys, you can\n# use replace_if_exists=False\ncollection.set('key1', 'value1', replace_if_exists=False)\n\n# retrieve a value by key\ncollection.get('key1')\n# \u003e\u003e\u003e 'value1'\n# note: the get method returns None for non-existing keys\n\n# update a value\ncollection.update('key1', 123)\ncollection.get('key1')\n# \u003e\u003e\u003e 123\n\n# delete a key-value pair\ncollection.delete('key1')\n\n# search for keys by value\ncollection.set('key2', 'common_value')\ncollection.set('key3', 'common_value')\ncollection.search('common_value')\n# \u003e\u003e\u003e ['key2', 'key3']\n\n# retrieve all keys, values and items\ncollection.keys()\n# \u003e\u003e\u003e ['key2', 'key3']\n\n# retrieve all values\ncollection.values()\n# \u003e\u003e\u003e ['common_value', 'common_value']\n\n# retrieve all key-value pairs\ncollection.items()\n# \u003e\u003e\u003e [('key2', 'common_value'), ('key3', 'common_value')]\n\n# check if a key exists\ncollection.key_exists('key2')\n# \u003e\u003e\u003e True\n\n# rename a collection\ncollection.change_name('new_collection_name')\n\n# delete a collection\ndb.delete_collection('new_collection_name')\n\n# get list of all collections\ndb.collections()\n# \u003e\u003e\u003e ['collection1', 'collection2', ...]\n\n# iterate over key-value pairs\nfor key, value in collection.iteritems():\n    print(f\"{key}: {value}\")\n\n# iterate over keys\nfor key in collection.iterkeys():\n    print(key)\n\n# iterate over values\nfor value in collection.itervalues():\n    print(value)\n\n# get with default value for missing keys\ncollection.get('missing_key', default='default_value')\n# \u003e\u003e\u003e 'default_value'\n\n# raise exception for missing keys\ntry:\n    collection.get('missing_key', raise_if_missing=True)\nexcept ValueError:\n    print(\"Key not found!\")\n```\n\nCollections allow you to organize your data into separate namespaces within the same database file.\nIn practice, they are tables inside the SQLite file.\n\n# License\n\nThis project is licensed under the MIT License. See the LICENSE file for details.\n\n# Contributing\n\nContributions are welcome! Please feel free to submit a PR.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenanmoretto%2Fkeyv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frenanmoretto%2Fkeyv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenanmoretto%2Fkeyv/lists"}