{"id":18087899,"url":"https://github.com/sopherapps/pydantic-redis","last_synced_at":"2025-04-12T16:33:44.927Z","repository":{"id":48086616,"uuid":"280786224","full_name":"sopherapps/pydantic-redis","owner":"sopherapps","description":"A simple Declarative ORM for Redis using pydantic Models","archived":false,"fork":false,"pushed_at":"2024-07-20T19:50:08.000Z","size":991,"stargazers_count":42,"open_issues_count":2,"forks_count":14,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T10:52:20.663Z","etag":null,"topics":["asyncio","orm","pydantic","python","redis"],"latest_commit_sha":null,"homepage":"https://sopherapps.github.io/pydantic-redis","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/sopherapps.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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":"2020-07-19T03:46:16.000Z","updated_at":"2025-03-18T21:49:02.000Z","dependencies_parsed_at":"2024-02-10T07:30:02.826Z","dependency_job_id":"eb3314eb-69a9-4823-bc03-fc22856492ca","html_url":"https://github.com/sopherapps/pydantic-redis","commit_stats":{"total_commits":109,"total_committers":3,"mean_commits":"36.333333333333336","dds":0.3027522935779816,"last_synced_commit":"0a2a892ae4d7f6fa36998733cbf31b1ba4afda3d"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sopherapps%2Fpydantic-redis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sopherapps%2Fpydantic-redis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sopherapps%2Fpydantic-redis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sopherapps%2Fpydantic-redis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sopherapps","download_url":"https://codeload.github.com/sopherapps/pydantic-redis/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248596563,"owners_count":21130720,"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":["asyncio","orm","pydantic","python","redis"],"created_at":"2024-10-31T17:09:27.022Z","updated_at":"2025-04-12T16:33:44.899Z","avatar_url":"https://github.com/sopherapps.png","language":"Python","readme":"# pydantic-redis\n\n[![PyPI version](https://badge.fury.io/py/pydantic-redis.svg)](https://badge.fury.io/py/pydantic-redis) ![CI](https://github.com/sopherapps/pydantic-redis/actions/workflows/ci.yml/badge.svg)\n\nA simple declarative ORM for Redis\n\n---\n\n**Documentation:** [https://sopherapps.github.io/pydantic-redis](https://sopherapps.github.io/pydantic-redis)\n\n**Source Code:** [https://github.com/sopherapps/pydantic-redis](https://github.com/sopherapps/pydantic-redis)\n\n--- \n\nMost Notable Features are:\n\n- Define business domain objects as [pydantic](https://github.com/samuelcolvin/pydantic/) and automatically get ability\n  to save them as is in [redis](https://pypi.org/project/redis/) with an intuitive API of `insert`, `update`, `delete`,\n  `select`\n- Maintain simple relationships between domain objects by simply nesting them either as single objects or lists, or tuples.\n  Any direct or indirect update to a nested object will automatically reflect in all parent objects that have it nested in\n  them when queried again from redis.\n- Both synchronous and asynchronous APIs available.\n\n## Benchmarks\n\n### \u003cv0.5\n\nOn an average PC ~16GB RAM, i7 Core\n\n```\n-------------------------------------------------- benchmark: 22 tests --------------------------------------------------\nName (time in us)                                                Mean                 Min                   Max          \n-------------------------------------------------------------------------------------------------------------------------\nbenchmark_select_columns_for_one_id[redis_store-book2]       124.2687 (1.00)     115.4530 (1.0)        331.8030 (1.26)   \nbenchmark_select_columns_for_one_id[redis_store-book0]       123.7213 (1.0)      115.6680 (1.00)       305.7170 (1.16)   \nbenchmark_select_columns_for_one_id[redis_store-book3]       124.4495 (1.01)     115.9580 (1.00)       263.4370 (1.0)    \nbenchmark_select_columns_for_one_id[redis_store-book1]       124.8431 (1.01)     117.4770 (1.02)       310.3140 (1.18)   \nbenchmark_select_columns_for_some_items[redis_store]         128.0657 (1.04)     118.6380 (1.03)       330.2680 (1.25)   \nbenchmark_delete[redis_store-Wuthering Heights]              131.8713 (1.07)     125.9920 (1.09)       328.9660 (1.25)   \nbenchmark_bulk_delete[redis_store]                           148.6963 (1.20)     142.3190 (1.23)       347.4750 (1.32)   \nbenchmark_select_all_for_one_id[redis_store-book3]           211.6941 (1.71)     195.6520 (1.69)       422.8840 (1.61)   \nbenchmark_select_all_for_one_id[redis_store-book2]           212.3612 (1.72)     195.9020 (1.70)       447.4910 (1.70)   \nbenchmark_select_all_for_one_id[redis_store-book1]           212.9524 (1.72)     197.7530 (1.71)       423.3030 (1.61)   \nbenchmark_select_all_for_one_id[redis_store-book0]           214.9924 (1.74)     198.8280 (1.72)       402.6310 (1.53)   \nbenchmark_select_columns_paginated[redis_store]              227.9248 (1.84)     211.0610 (1.83)       425.8390 (1.62)   \nbenchmark_select_some_items[redis_store]                     297.5700 (2.41)     271.1510 (2.35)       572.1220 (2.17)   \nbenchmark_select_default_paginated[redis_store]              301.7495 (2.44)     282.6500 (2.45)       490.3450 (1.86)   \nbenchmark_select_columns[redis_store]                        316.2119 (2.56)     290.6110 (2.52)       578.0310 (2.19)   \nbenchmark_update[redis_store-Wuthering Heights-data0]        346.5816 (2.80)     304.5420 (2.64)       618.0250 (2.35)   \nbenchmark_single_insert[redis_store-book2]                   378.0613 (3.06)     337.8070 (2.93)       616.4930 (2.34)   \nbenchmark_single_insert[redis_store-book0]                   396.6513 (3.21)     347.1000 (3.01)       696.1350 (2.64)   \nbenchmark_single_insert[redis_store-book3]                   395.9082 (3.20)     361.0980 (3.13)       623.8630 (2.37)   \nbenchmark_single_insert[redis_store-book1]                   401.1377 (3.24)     363.5890 (3.15)       610.4400 (2.32)   \nbenchmark_select_default[redis_store]                        498.4673 (4.03)     428.1350 (3.71)       769.7640 (2.92)   \nbenchmark_bulk_insert[redis_store]                         1,025.0436 (8.29)     962.2230 (8.33)     1,200.3840 (4.56)   \n-------------------------------------------------------------------------------------------------------------------------\n```\n\n# \u003ev0.5 (with pydantic v2)\n\n```\n------------------------------------------------ benchmark: 22 tests ------------------------------------------------\nName (time in us)                                              Mean                 Min                 Max          \n---------------------------------------------------------------------------------------------------------------------\nbenchmark_delete[redis_store-Wuthering Heights]            116.4282 (1.0)      103.9220 (1.0)      366.6500 (1.0)    \nbenchmark_bulk_delete[redis_store]                         125.1484 (1.07)     110.2590 (1.06)     393.1860 (1.07)   \nbenchmark_select_columns_for_one_id[redis_store-book0]     176.7461 (1.52)     151.4150 (1.46)     484.4690 (1.32)   \nbenchmark_select_columns_for_one_id[redis_store-book3]     175.1838 (1.50)     152.3430 (1.47)     443.8120 (1.21)   \nbenchmark_select_columns_for_one_id[redis_store-book1]     176.9439 (1.52)     152.9350 (1.47)     464.4280 (1.27)   \nbenchmark_select_columns_for_one_id[redis_store-book2]     176.7885 (1.52)     153.0280 (1.47)     520.9390 (1.42)   \nbenchmark_select_all_for_one_id[redis_store-book0]         198.9879 (1.71)     173.8040 (1.67)     527.0550 (1.44)   \nbenchmark_select_all_for_one_id[redis_store-book1]         199.1717 (1.71)     175.8920 (1.69)     461.5000 (1.26)   \nbenchmark_select_all_for_one_id[redis_store-book2]         197.1996 (1.69)     177.9590 (1.71)     473.8830 (1.29)   \nbenchmark_select_all_for_one_id[redis_store-book3]         198.1436 (1.70)     178.1040 (1.71)     493.0560 (1.34)   \nbenchmark_select_columns_for_some_items[redis_store]       230.9837 (1.98)     209.6070 (2.02)     441.7680 (1.20)   \nbenchmark_select_columns_paginated[redis_store]            242.5208 (2.08)     212.4460 (2.04)     512.9250 (1.40)   \nbenchmark_update[redis_store-Wuthering Heights-data0]      253.0142 (2.17)     223.0690 (2.15)     548.3980 (1.50)   \nbenchmark_single_insert[redis_store-book2]                 287.5952 (2.47)     246.2610 (2.37)     593.2120 (1.62)   \nbenchmark_select_some_items[redis_store]                   274.5612 (2.36)     248.9740 (2.40)     539.6020 (1.47)   \nbenchmark_select_default_paginated[redis_store]            280.0070 (2.40)     254.9000 (2.45)     587.5320 (1.60)   \nbenchmark_single_insert[redis_store-book3]                 293.2912 (2.52)     256.2000 (2.47)     523.5340 (1.43)   \nbenchmark_single_insert[redis_store-book1]                 299.4127 (2.57)     258.5760 (2.49)     564.0550 (1.54)   \nbenchmark_single_insert[redis_store-book0]                 293.0470 (2.52)     261.1910 (2.51)     590.2880 (1.61)   \nbenchmark_select_columns[redis_store]                      347.7573 (2.99)     313.4880 (3.02)     624.8470 (1.70)   \nbenchmark_select_default[redis_store]                      454.2192 (3.90)     398.2550 (3.83)     775.3050 (2.11)   \nbenchmark_bulk_insert[redis_store]                         721.2247 (6.19)     673.9940 (6.49)     958.1200 (2.61)   \n---------------------------------------------------------------------------------------------------------------------\n```\n\n# \u003e=v0.7 (with deeply nested models)\n\n```\n------------------------------------------------- benchmark: 22 tests -------------------------------------------------\nName (time in us)                                              Mean                 Min                   Max          \n-----------------------------------------------------------------------------------------------------------------------\nbenchmark_delete[redis_store-Wuthering Heights]            123.2946 (1.02)     107.9690 (1.0)        502.6140 (1.33)   \nbenchmark_bulk_delete[redis_store]                         120.5815 (1.0)      111.9320 (1.04)       378.8660 (1.0)    \nbenchmark_select_columns_for_one_id[redis_store-book2]     208.2612 (1.73)     180.4660 (1.67)       470.9860 (1.24)   \nbenchmark_select_columns_for_one_id[redis_store-book1]     207.9143 (1.72)     180.6440 (1.67)       489.6890 (1.29)   \nbenchmark_select_columns_for_one_id[redis_store-book0]     204.2471 (1.69)     183.4360 (1.70)       485.2500 (1.28)   \nbenchmark_select_columns_for_one_id[redis_store-book3]     209.5764 (1.74)     189.5780 (1.76)       462.5650 (1.22)   \nbenchmark_select_all_for_one_id[redis_store-book0]         226.4569 (1.88)     207.4920 (1.92)       499.9470 (1.32)   \nbenchmark_select_all_for_one_id[redis_store-book3]         241.5488 (2.00)     210.5230 (1.95)       504.5150 (1.33)   \nbenchmark_select_all_for_one_id[redis_store-book1]         234.4014 (1.94)     210.6420 (1.95)       501.2470 (1.32)   \nbenchmark_select_all_for_one_id[redis_store-book2]         228.9277 (1.90)     212.0090 (1.96)       509.5740 (1.34)   \nbenchmark_update[redis_store-Wuthering Heights-data0]      276.3908 (2.29)     238.3390 (2.21)       704.9450 (1.86)   \nbenchmark_single_insert[redis_store-book3]                 311.0476 (2.58)     262.2940 (2.43)       589.3940 (1.56)   \nbenchmark_select_columns_for_some_items[redis_store]       291.2779 (2.42)     266.0960 (2.46)       564.3510 (1.49)   \nbenchmark_select_columns_paginated[redis_store]            300.4108 (2.49)     269.4740 (2.50)       552.8510 (1.46)   \nbenchmark_single_insert[redis_store-book1]                 304.5771 (2.53)     274.1740 (2.54)       547.5210 (1.45)   \nbenchmark_single_insert[redis_store-book2]                 317.2681 (2.63)     275.6170 (2.55)       641.5440 (1.69)   \nbenchmark_single_insert[redis_store-book0]                 313.0004 (2.60)     277.3190 (2.57)       558.2160 (1.47)   \nbenchmark_select_some_items[redis_store]                   343.2569 (2.85)     311.9140 (2.89)       624.6600 (1.65)   \nbenchmark_select_default_paginated[redis_store]            359.8463 (2.98)     325.8310 (3.02)       623.2360 (1.65)   \nbenchmark_select_columns[redis_store]                      486.6047 (4.04)     429.3250 (3.98)       867.8780 (2.29)   \nbenchmark_select_default[redis_store]                      631.3835 (5.24)     584.7630 (5.42)     1,033.5990 (2.73)   \nbenchmark_bulk_insert[redis_store]                         761.0832 (6.31)     724.1240 (6.71)     1,034.2950 (2.73)   \n-----------------------------------------------------------------------------------------------------------------------\n```\n\n## Contributions\n\nContributions are welcome. The docs have to maintained, the code has to be made cleaner, more idiomatic and faster,\nand there might be need for someone else to take over this repo in case I move on to other things. It happens!\n\nWhen you are ready, look at the [CONTRIBUTIONS GUIDELINES](./CONTRIBUTING.md)\n\n## License\n\nCopyright (c) 2020 [Martin Ahindura](https://github.com/Tinitto) Licensed under the [MIT License](./LICENSE)\n\n## Gratitude\n\n\u003e \"There is no condemnation now for those who live in union with Christ Jesus.\n\u003e For the law of the Spirit, which brings us life in union with Christ Jesus,\n\u003e has set me free from the law of sin and death\"\n\u003e\n\u003e -- Romans 8: 1-2\n\nAll glory be to God\n\n\u003ca href=\"https://www.buymeacoffee.com/martinahinJ\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" style=\"height: 60px !important;width: 217px !important;\" \u003e\u003c/a\u003e\n","funding_links":["https://www.buymeacoffee.com/martinahinJ"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsopherapps%2Fpydantic-redis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsopherapps%2Fpydantic-redis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsopherapps%2Fpydantic-redis/lists"}