{"id":21616962,"url":"https://github.com/metal3d/rethinkmodel","last_synced_at":"2025-03-18T17:24:42.562Z","repository":{"id":54191048,"uuid":"338586139","full_name":"metal3d/rethinkmodel","owner":"metal3d","description":"Rethink:Model - use Python annotation to describe RethinkDB Models - ORM","archived":false,"fork":false,"pushed_at":"2021-03-07T14:05:01.000Z","size":3398,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-26T22:05:32.031Z","etag":null,"topics":["orm","python","rethinkdb"],"latest_commit_sha":null,"homepage":"https://metal3d.github.io/rethinkmodel/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/metal3d.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-13T13:56:07.000Z","updated_at":"2021-05-20T22:39:48.000Z","dependencies_parsed_at":"2022-08-13T08:50:24.106Z","dependency_job_id":null,"html_url":"https://github.com/metal3d/rethinkmodel","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metal3d%2Frethinkmodel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metal3d%2Frethinkmodel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metal3d%2Frethinkmodel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metal3d%2Frethinkmodel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/metal3d","download_url":"https://codeload.github.com/metal3d/rethinkmodel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244267476,"owners_count":20425835,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["orm","python","rethinkdb"],"created_at":"2024-11-24T22:16:00.621Z","updated_at":"2025-03-18T17:24:42.544Z","avatar_url":"https://github.com/metal3d.png","language":"Python","readme":"# Rethink:Model\n\n[![PyPI version](https://badge.fury.io/py/rethinkmodel.svg)](https://badge.fury.io/py/rethinkmodel)\n[![Build\nStatus](https://www.travis-ci.org/metal3d/rethinkmodel.svg?branch=master)](https://www.travis-ci.org/metal3d/rethinkmodel)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=rethinkmodel\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=rethinkmodel)\n[![Documentation](https://badgen.net/badge/doc/official/green)](https://metal3d.github.io/rethinkmodel)\n\nSimple and easy to use ORM for [RethinkDB](https://www.rethinkdb.com).\nUse Python `typing` package and annotations to describe data\nrepresentation.\n\nRethinkModel aims to help you to describe your data as classes to be\neasilly created, updated and get from\n[RethinkDB](https://www.rethinkdb.com).\n\nRethink:Model make uses of [typing\nsupport](https://docs.python.org/3/library/typing.html) annotations -\nPython annotations describe the model fields. That’s easy, you only have\nto import the standard `typing` module, and use any of `Optionnal`,\n`Type`, `List`, `Union`… types.\n\n## It’s simple as a pie\n\n``` python\nfrom typing import Optional, List\nfrom rethinkdb.model import Model\n\nclass Post(Model):\n    author: User  # One to One relation to User\n    content: str\n    tags: Optional[List[str]] # use typing, tags can be None\n\nclass User(Model):\n    login: str\n    email: str\n\n# save\nuser = User(login=\"John\", email=\"me@foo.com\").save()\npost = Post(author=user, content=\"This is the post\").save()\n\n# get user\nuser = User.get(user.id)\n\n# get Post\npost = Post.get(post.id)\n# post.author is an User, but in DB it's the ID\n\n# get post from User ?\nuser = User.get(user.id).join(Project)\n# user.projects is now filled\n```\n\nThere are **other methods** like `join()`, `get_all()` and so on. Please\ncheck documentation.\n\n## The goals\n\n  - Describe the models in the simplest possible way, but also in the\n    most meaningful way\n  - Make use of powerful typing package from Python \\\u003e 3.7\n  - Avoid type checking at runtime (What ?) but let your IDE punish you\n\nPython is not a staticly typed langage. But Python developers want it\n(or not 😜) - So there are many Python tools that are designed to use\ntyping package which is integrated with Python SDK: Pyright (use by\nPyLance), MyPy, PyType…\n\nYour IDE can make type checking.\n\n  - Vim can use\n    [coc-pyright](https://github.com/fannheyward/coc-pyright)\n  - VsCode can use\n    [PyLance](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance)\n  - PyCharm knows how to manage typing\n  - etc…\n\nSo, let’s use typing \\! Rethink:Model is designed to use the typing\npackage.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetal3d%2Frethinkmodel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetal3d%2Frethinkmodel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetal3d%2Frethinkmodel/lists"}