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.1.tar.gz
(10.6 kB
view details)
Built Distribution
aio_rom-0.1.1-py3-none-any.whl
(11.3 kB
view details)
File details
Details for the file aio-rom-0.1.1.tar.gz
.
File metadata
- Download URL: aio-rom-0.1.1.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.0a2 CPython/3.9.6 Linux/5.8.0-1039-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fca4f72acf73f6a6d289355aaebe14dc9ae5e5374b550dfe938d60f46eea5b5 |
|
MD5 | c8cd85061fde0d7cf9d8ae07ea9234f5 |
|
BLAKE2b-256 | 22b4387dc4056ba0a413229a728dc8c8528c6e9c70c044b8f097c85ea244b27e |
File details
Details for the file aio_rom-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: aio_rom-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.0a2 CPython/3.9.6 Linux/5.8.0-1039-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b858533062d6ed89e27fb39706ac4a5cfee0c27afbb2a8d2e0850b02f1ab726 |
|
MD5 | eec70e7a44efcd5568b91a66e5019a39 |
|
BLAKE2b-256 | 3b050b637eb8efbe8fbd422f354064a4c64850e2c2a70ce163c31a1d0da79771 |