{"id":15175873,"url":"https://github.com/sailist/dbrecord","last_synced_at":"2025-10-26T11:31:23.844Z","repository":{"id":92018788,"uuid":"432381498","full_name":"sailist/dbrecord","owner":"sailist","description":"A pure-python, light-weight, sqlite based, persistent list and dict.","archived":false,"fork":false,"pushed_at":"2023-03-04T06:57:55.000Z","size":82,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-31T18:56:32.089Z","etag":null,"topics":["persistent-storage","sqlite"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sailist.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}},"created_at":"2021-11-27T05:59:01.000Z","updated_at":"2024-01-03T02:12:17.000Z","dependencies_parsed_at":"2023-07-03T16:16:27.942Z","dependency_job_id":null,"html_url":"https://github.com/sailist/dbrecord","commit_stats":{"total_commits":58,"total_committers":2,"mean_commits":29.0,"dds":"0.051724137931034475","last_synced_commit":"3ed05a0279ab160c2643a06cd20821db63f119c9"},"previous_names":["pytorch-lumo/dbrecord"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sailist%2Fdbrecord","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sailist%2Fdbrecord/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sailist%2Fdbrecord/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sailist%2Fdbrecord/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sailist","download_url":"https://codeload.github.com/sailist/dbrecord/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238319457,"owners_count":19452340,"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":["persistent-storage","sqlite"],"created_at":"2024-09-27T12:43:26.538Z","updated_at":"2025-10-26T11:31:23.491Z","avatar_url":"https://github.com/sailist.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dbrecord\n\ndbrecord provides a light-weight, sqlite based, persistent list and dict.\n\n## install\n\n```shell\npip install dbrecord -U\n```\n\n# how to use\n\n## PDict\n\ncreate a pdict\n\n```python\nfrom dbrecord import PDict\n\ndic = PDict('./disk.sqlite')\nfor i in range(5000):\n    dic[f'{i}'] = i\nassert len(dic) == 5000\n\ndic2 = PDict('./disk.sqlite')\nassert len(dic2) == 5000\n\nres, missing = dic.gets([f'{i}' for i in range(5001)])  # type: dict, set\nassert len(missing) == 1\nprint(missing)\nfor i in range(5000):\n    assert res[f'{i}'] == i\n```\n\n## PList\n\n```python\nfrom dbrecord import PList\n\nlis = PList('./disk.sqlite')\nfor i in range(20):\n    lis.append(i)\n\nlsl = lis[2:16:2]\nassert list(lsl) == list(range(20)[2:16:2])\nassert list(lsl[0:20]) == list(range(20))\nassert lsl[0] == lis[2]\nassert len(lsl) == (14 // 2)\n\ntry:\n    _ = lsl[8]\n    assert False\nexcept IndexError:\n    pass\n\nfor i, j in zip(lis, range(20)):\n    assert i == j\n\nres, missing = lis.select([1, 1, 2, 3])\nassert (res, missing) == ([1, 1, 2, 3], set())\n\ntry:\n    _ = lis[100]\n    assert False\nexcept IndexError:\n    pass\n```\n\n# With other backend\n\n```python\ndic = PDict('./temp.sqlite', cache_size=test_size // 2,\n            backend_dump='quickle',\n            backend_load='quickle')\n```\n\n```python\nimport json\n\ndic = PDict('./temp.sqlite', cache_size=test_size // 2,\n            backend_dump=json.dumps,\n            backend_load=json.loads)\n```\n\n# benchmark\n\nsee logs in [benchmark.md](./benchmark.md) or run\n\n```shell\ngit clone https://github.com/sailist/dbrecord\ncd dbrecord\ncd example\npython benchmark.py\n```\n\n# Reference\n\n- https://gist.github.com/joseafga/ff798d340d79107ace14fd232abc4376\n- [sqlitedict](https://github.com/piskvorky/sqlitedict)\n- [quickle](https://github.com/jcrist/quickle)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsailist%2Fdbrecord","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsailist%2Fdbrecord","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsailist%2Fdbrecord/lists"}