Skip to main content

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 typing import Set

import rom

# Library will wrap the class into a dataclass and detect fields from that
class Foo(rom.Model):
    bar: int
    foobar: Set[int] = rom.field(default_factory=set)
    my_boolean: bool = False
    transient_field: Dict = rom.field(transient=True)

class OtherFoo(rom.Model):
    foo: Foo

async def main():
    await rom.init("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

  1. Docs
  2. Tests
  3. Pypi
  4. Update specific model fields

Limitations

  1. init must be called before other calls to Redis can succeed, no defaults to localhost atm.
  2. You cannot use from __future__ import annotations in the same file you define your models. See https://bugs.python.org/issue39442
  3. TODO Supported datatypes
  4. Probably more ...

Project details


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.0.tar.gz (14.6 kB view hashes)

Uploaded Source

Built Distribution

aio_rom-0.1.0-py3-none-any.whl (11.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page