Skip to main content

RedORM

A simple Redis ORM that only a madman would use in production.
The red in RedORM both means Redis as well as the color red, as red is the fastest colour!

Quick Start

To install pip install redorm

from dataclasses import dataclass
from redorm import RedormBase, one_to_one, one_to_many, many_to_one, many_to_many


@dataclass
class Person(RedormBase):
    name: str
    age: int
    siblings = many_to_many(foreign_type="Person", backref="siblings")
    dad = many_to_one(foreign_type="Person", backref="children")
    children = one_to_many(foreign_type="Person", backref="dad")
    favourite_color = one_to_one("Color", backref="liker")


@dataclass
class Color(RedormBase):
    name: str
    liker = one_to_one(Person, backref="favourite_color")
>>> red = Color.create(name="Red")
>>> homer = Person.create(name="Homer", age=50, favourite_color=red)
>>> print(repr(homer.favourite_color))
Color(id='dcb9aa50-554a-40a5-9acf-7d86c982e5ee', name='Red')
>>> print(repr(homer.children))
[]
>>> bart = Person.create(name="Bart", age=11, dad=homer)
>>> print(repr(homer.children))
[Person(id='424cd574-5382-4d34-89da-7233b3928405', name='Bart', age=11)]
>>> print(repr(bart.favourite_color))
None
>>> blue = Color.create(name="Blue", liker=bart)
>>> print(repr(bart.favourite_color))
Color(id='dc9df3c2-c592-4d87-a45e-f88a346342b4', name='Blue')
>>> print(repr(blue.liker))
Person(id='424cd574-5382-4d34-89da-7233b3928405', name='Bart', age=11)
>>> lisa = Person.create(name="Lisa", age=9, dad=homer.id, siblings=[bart])
>>> print(repr(homer.children))
[Person(id='205a459a-572c-41af-bae3-e6e730aada97', name='Lisa', age=9), Person(id='424cd574-5382-4d34-89da-7233b3928405', name='Bart', age=11)]
>>> bart.dad = None
>>> print(repr(homer.children))
[Person(id='205a459a-572c-41af-bae3-e6e730aada97', name='Lisa', age=9)]

Why Redorm?

  • Thread Safe
  • Very fast
  • Super simple to use
  • Very little boilerplate

Why not Redorm?

  • Made in an afternoon
  • Unlikely to be maintained
  • Not thoroughly tested
  • NOT THOROUGHLY TESTED
  • Writing your own ORM is fantastic for learning, but you should not use it in prod

Metadata

Release files for redorm 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for redorm 0.7.0
File Size Uploaded
redorm-0.7.0.tar.gz 9.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for redorm 0.7.0
File Interpreter ABI Platform
redorm-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.2 kB

Release files / redorm-0.7.0.tar.gz

Download URL redorm-0.7.0.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6ec73ae60c087b38bb59c25610ce6baa9eec2da7b1f2939aed6a0e27f54ea12f
BLAKE2b-256 checksum
How to use checksums
fd1e80d8d4b7c120c1d5c92e2f2d7a86f91584306b22193946dbec9f62aa2bac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.9.1 Linux/5.4.0-1032-azure

Release files / redorm-0.7.0-py3-none-any.whl

Download URL redorm-0.7.0-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4125a8db2fa7147eeaec695d131cf136b040eba5d7e994bacbe0b9310c546590
BLAKE2b-256 checksum
How to use checksums
208711935f9ad0a0ddbafc29f340b13551cf0107297844a5ba95af39305f611c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.9.1 Linux/5.4.0-1032-azure

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 release files

0.6.9

2 release files

0.6.8

2 release files

0.6.7

2 release files

0.6.6

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.3

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page