Skip to main content

Rethink:Model

Build Status Quality Gate Status Documentation

Simple and easy to use ORM for RethinkDB. Use Python typing package and annotations to describe data representation.

RethinkModel aims to help you to describe your data as classes to be easilly created, updated and get from RethinkDB.

Rethink:Model make uses of typing support annotations - Python annotations describe the model fields. That’s easy, you only have to import the standard typing module, and use any of Optionnal, Type, List, Union… types.

It’s simple as a pie

from typing import Optional, List
from rethinkdb.model import Model

class Post(Model):
    author: User  # One to One relation to User
    content: str
    tags: Optional[List[str]] # use typing, tags can be None

class User(Model):
    login: str
    email: str

# save
user = User(login="John", email="me@foo.com").save()
post = Post(author=user, content="This is the post").save()

# get user
user = User.get(user.id)

# get Post
post = Post.get(post.id)
# post.author is an User, but in DB it's the ID

# get post from User ?
user = User.get(user.id).join(Project)
# user.projects is now filled

There are other methods like join(), get_all() and so on. Please check documentation.

The goals

  • Describe the models in the simplest possible way, but also in the most meaningful way
  • Make use of powerful typing package from Python > 3.7
  • Avoid type checking at runtime (What ?) but let your IDE punish you

Python is not a staticly typed langage. But Python developers want it (or not 😜) - So there are many Python tools that are designed to use typing package which is integrated with Python SDK: Pyright (use by PyLance), MyPy, PyType…

Your IDE can make type checking.

  • Vim can use coc-pyright
  • VsCode can use PyLance
  • PyCharm knows how to manage typing
  • etc…

So, let’s use typing ! Rethink:Model is designed to use the typing package.

Metadata

Release files for rethinkmodel 0.1.1

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

Source distribution (sdist)

Source distribution for rethinkmodel 0.1.1
File Size Uploaded
rethinkmodel-0.1.1.tar.gz 11.0 kB Details

Built distribution (wheel)

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

Total release size: 22.1 kB

Release files / rethinkmodel-0.1.1.tar.gz

Download URL rethinkmodel-0.1.1.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a435256ce38b2411515fe1883a69cc0cd242ce127af39bedd8067674bdbbe241
BLAKE2b-256 checksum
How to use checksums
9fbf8c2cb3c577d5d9b6ef7056914672b01c06c4f85ee45e427315ed36cec79f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2

Release files / rethinkmodel-0.1.1-py3-none-any.whl

Download URL rethinkmodel-0.1.1-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
096abfc6eea818707f37a127afe39aa5cc113a11ea50b7956fcc45c17c250e60
BLAKE2b-256 checksum
How to use checksums
3e3ae6d93997b9417a53b5536e64db56545fbd45f9af97781c72d2585c9d97ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2

Release history Release notifications | RSS feed

This release

0.1.1 This release

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