{"id":22125608,"url":"https://github.com/dsoftwareinc/redis-models","last_synced_at":"2025-03-24T08:15:40.287Z","repository":{"id":164819587,"uuid":"637539098","full_name":"dsoftwareinc/redis-models","owner":"dsoftwareinc","description":"Redis ORM library that gives redis easy-to-use objects with fields and speeds a development up","archived":false,"fork":false,"pushed_at":"2023-05-13T13:37:56.000Z","size":39,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-29T13:27:45.360Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/dsoftwareinc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2023-05-07T21:23:47.000Z","updated_at":"2023-05-07T21:24:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"fad3cb32-3e61-4655-b025-bf036a92201b","html_url":"https://github.com/dsoftwareinc/redis-models","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsoftwareinc%2Fredis-models","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsoftwareinc%2Fredis-models/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsoftwareinc%2Fredis-models/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsoftwareinc%2Fredis-models/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dsoftwareinc","download_url":"https://codeload.github.com/dsoftwareinc/redis-models/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245232886,"owners_count":20581701,"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":[],"created_at":"2024-12-01T16:35:41.117Z","updated_at":"2025-03-24T08:15:40.266Z","avatar_url":"https://github.com/dsoftwareinc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# redis-models\n\nRedis ORM library that gives redis easy-to-use objects with fields and speeds a development up,\ninspired by Django ORM.\n\n## Install\n\nInstall using pip:\n\n```shell\npip install redis-models\n```\n\n## Configure\n\nYou can configure the way redis-models work using the `BaseRedisManager` class.\n\n```python\nBaseRedisManager(\n    # redis.ConnectionPool - will try to connect to localhost:6389/0 if none is provided\n    connection_pool=None,\n\n    # Default prefix for all keys stored in redis.\n    prefix='redis_test',\n\n    # Should deserialization errors raise an exception?\n    ignore_deserialization_errors=True,\n\n    # Whether KEYS or SCAN should be used for getting all instances matching a pattern from redis.\n    # When the database size is relatively small, KEYS is significantly faster, however, when\n    # the database is getting bigger, SCAN has better performance since it does not require to load all\n    # keys at once\n    use_keys=True,\n\n    # Perform actions in a non-blocking manner (do not wait for ack from redis).\n    non_blocking=False,\n)\n```\n\n## Usage\n\nThis package has Django-like architecture for `RedisModel` classes.\nA `RedisModel` has a `RedisModelManager` class which can be used to create, query, update, delete\nexisting instances in redis.\n\n## Supported field types\n\n`RedisField` - base class for nesting all fields, support default value, set of choices,\nand whether field is nullable (empty).\n\n- `RedisString` - string\n- `RedisNumber` - int or float\n- `RedisId` - instances IDs\n- `RedisBool` - bool\n- `RedisDecimal` - working accurately with numbers via decimal\n- `RedisJson` - for data, that can be used with `json.loads`/`json.dumps`.\n- `RedisList` - list\n- `RedisDict` - dict\n- `RedisDateTime` - for work with date and time, via python datetime.datetime\n- `RedisDate` - for work with date, via python datetime.data\n- `RedisForeignKey` - for link to other instance\n- `RedisManyToMany` - for links to other instances\n\n## Filtering\n\nUsing your model manager, you can query and filter instances of the model.\nFor example, for the model:\n\n```python\nfrom redis_models import (RedisModel, RedisString, RedisDateTime, )\n\n\nclass BotSession(RedisModel):\n    session_token = RedisString(default='session_token_value')\n    created = RedisDateTime(default=datetime.datetime.now)\n```\n\nIt is possible to query:\n\n```python\nBotSession.objects.query(session_token='session_token_value')\n# Will return the instances with session_token='session_token_value'\n\nyesterday = datetime.datetime.now() - datetime.timedelta(days=1)\nBotSession.objects.query(created__gte=yesterday)\n# Will return all instances that have created \u003e= yesterday.\n```\n\nSupported filtering:\n\n- `exact` - equality\n- `iexact` - case-independent equality\n- `contains` - is filter string in the value string\n- `icontains` - is filter string case-independent in the value string\n- `in` - is value in the provided list\n- `gt` - is value greater\n- `gte` - is value greater or equals\n- `lt` - is value less\n- `lte` - is value less or equals\n- `startswith` - is string starts with\n- `istartswith` - is string case-independent starts with\n- `endswith` - is string ends with\n- `iendswith` - is string case-independent ends wth\n- `range` - is value in provided range\n- `isnull` - is value in [\"null\", None]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdsoftwareinc%2Fredis-models","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdsoftwareinc%2Fredis-models","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdsoftwareinc%2Fredis-models/lists"}