asyncio based Redis object mapper
Project description
Python Redis Object Mapper
asyncio based Redis object mapper
Table of content
Installation
TODO
Usage
import asyncio
from dataclasses import field
from typing import Set, Dict
from aio_rom import Model
from aio_rom.fields import Metadata
from aio_rom.session import redis_pool
class Foo(Model):
bar: int
foobar: Set[int] = field(default_factory=set)
my_boolean: bool = False
transient_field: Dict = field(metadata=Metadata(transient=True))
class OtherFoo(Model):
foo: Foo
async def main():
async with redis_pool("redis://localhost"):
foo = Foo(123, {1,2,3}, True)
await foo.save()
...
foo2 = await Foo.get(321)
other_foo = OtherFoo(303, foo2)
await other_foo.save()
asyncio.run(main())
Features
TODO
TODO
- Docs
- Tests
Limitations
configure
must be called before other calls to Redis can succeed, no defaults to localhost atm.- You cannot use
from __future__ import annotations
in the same file you define your models. See https://bugs.python.org/issue39442 - TODO Supported datatypes
- Probably more ...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aio-rom-0.1.2.tar.gz
(10.7 kB
view details)
Built Distribution
aio_rom-0.1.2-py3-none-any.whl
(12.2 kB
view details)
File details
Details for the file aio-rom-0.1.2.tar.gz
.
File metadata
- Download URL: aio-rom-0.1.2.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.0a2 CPython/3.10.1 Linux/5.11.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 616da0b74186c8d77f61c9357e288c2e6a1b2873c06524bb321b8fc3e7188f67 |
|
MD5 | 00b88766fa35699c27178836f202fb9c |
|
BLAKE2b-256 | f30be1bb93619d7a36c56958fce6506df06617db39d25c5f7f540da9926a5305 |
File details
Details for the file aio_rom-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: aio_rom-0.1.2-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.0a2 CPython/3.10.1 Linux/5.11.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e52fb8e078455abcb3be8216fc13db48faf2686df2f3df4f338dd69e3b7ebdc7 |
|
MD5 | eac63dd3bcb4cd8d827d076164ecff4a |
|
BLAKE2b-256 | a946d6f87031f066fecf219afd5ba856acd727f3314ff6cac7e815d19180f668 |