{"id":13771447,"url":"https://github.com/linkyndy/remodel","last_synced_at":"2025-12-18T07:02:55.960Z","repository":{"id":13925473,"uuid":"16624934","full_name":"linkyndy/remodel","owner":"linkyndy","description":"Very simple yet powerful and extensible Object Document Mapper for RethinkDB, written in Python.","archived":false,"fork":false,"pushed_at":"2020-05-13T14:39:43.000Z","size":126,"stargazers_count":191,"open_issues_count":3,"forks_count":28,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-11-30T14:43:07.170Z","etag":null,"topics":["object-document-mapper","python","rethinkdb"],"latest_commit_sha":null,"homepage":null,"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/linkyndy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"linkyndy"}},"created_at":"2014-02-07T19:26:18.000Z","updated_at":"2025-06-24T22:10:26.000Z","dependencies_parsed_at":"2022-09-17T08:11:04.906Z","dependency_job_id":null,"html_url":"https://github.com/linkyndy/remodel","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/linkyndy/remodel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkyndy%2Fremodel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkyndy%2Fremodel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkyndy%2Fremodel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkyndy%2Fremodel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linkyndy","download_url":"https://codeload.github.com/linkyndy/remodel/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkyndy%2Fremodel/sbom","scorecard":{"id":591115,"data":{"date":"2025-08-11","repo":{"name":"github.com/linkyndy/remodel","commit":"5434094869b563aa0f23a11523428452e93efbb6"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 1/12 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 27 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T21:55:04.651Z","repository_id":13925473,"created_at":"2025-08-20T21:55:04.651Z","updated_at":"2025-08-20T21:55:04.651Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27792998,"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","status":"online","status_checked_at":"2025-12-18T02:00:09.725Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["object-document-mapper","python","rethinkdb"],"created_at":"2024-08-03T17:00:51.572Z","updated_at":"2025-12-18T07:02:55.941Z","avatar_url":"https://github.com/linkyndy.png","language":"Python","funding_links":["https://github.com/sponsors/linkyndy"],"categories":["Awesome RethinkDB [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome)","Python","ODM, ORM, Active Record"],"sub_categories":["Table of Contents"],"readme":"remodel\n=======\n\n[![Build Status](https://travis-ci.org/linkyndy/remodel.svg?branch=master)](https://travis-ci.org/linkyndy/remodel)\n\nVery simple yet powerful and extensible Object Document Mapper for RethinkDB, written in Python.\n\n## It is plain simple!\n\n```python\nfrom remodel.models import Model\n\nclass User(Model):\n    pass\n```\n\nThat's really everything you need to do to set up a model!\n\n\u003e Don't forget to turn on your RethinkDB server and to create your tables (check the examples below for a helper that does just that!).\n\n## Features\n\n- schemaless;\n- `dict` interface;\n- full support for relations;\n- indexes;\n- convention over configuration;\n- lazy-loading;\n- caching;\n- thoroughly tested;\n\n## Installation\n\n```bash\npip install remodel\n```\n\n## Examples\n\n### Basic CRUD operations\n\n```python\nclass Order(Model):\n    pass\n\n# Create\nmy_order = Order.create(customer='Andrei', shop='GitHub')\n# Update\nmy_order['total'] = 100\nmy_order.save()\n# Read\nsaved_order = Order.get(customer='Andrei')\n# Delete\nsaved_order.delete()\n```\n\n### Creating tables\n\n```python\nfrom remodel.models import Model\nfrom remodel.helpers import create_tables, create_indexes\n\nclass Party(Model):\n    has_many = ('Guest',)\n\nclass Guest(Model):\n    belongs_to = ('Party',)\n\n# Creates all database tables defined by models\ncreate_tables()\n# Creates all table indexes based on model relations\ncreate_indexes()\n```\n\n### Configuring database connection\n\nSetups are widely different, so here's how you need to configure remodel in order to connect to your RethinkDB database:\n\n```python\nfrom remodel.connection import pool\n\npool.configure(host='localhost', port=28015, auth_key=None, user='admin', password='', db='test')\n```\n\n### Relations\n\n#### Has one / Belongs to\n\n```python\nclass User(Model):\n    has_one = ('Profile',)\n\nclass Profile(Model):\n    belongs_to = ('User',)\n\nandrei = User.create(name='Andrei')\nprofile = Profile.create(user=andrei, network='GitHub', username='linkyndy')\nprint profile['user']['name'] # prints Andrei\n```\n\n#### Has many / Belongs to\n\n```python\nclass Country(Model):\n    has_many = ('City',)\n\nclass City(Model):\n    belongs_to = ('Country',)\n\nromania = Country.create(name='Romania')\nromania['cities'].add(City(name='Timisoara'), City(name='Bucharest'))\nprint romania['cities'].count() # prints 2\n```\n\n#### Has and belongs to many\n\n```python\nclass Post(Model):\n    has_and_belongs_to_many = ('Tag',)\n\nclass Tag(Model):\n    has_and_belongs_to_many = ('Post',)\n\nmy_post = Post.create(name='My first post')\npersonal_tag = Tag.create(name='personal')\npublic_tag = Tag.create(name='public')\nmy_post['tags'].add(personal_tag, public_tag)\nprint my_post['tags'].count() # prints 2\n```\n\n#### Has many through\n\n```python\nclass Recipe(Model):\n    has_many = ('SpecificSpice',)\n\nclass Chef(Model):\n    has_many = ('SpecificSpice',)\n\nclass SpecificSpice(Model):\n    belongs_to = ('Recipe', 'Chef')\n\nquattro_formaggi = Recipe.create(name='Pizza Quattro Formaggi')\nandrei = Chef.create(name='Andrei')\nandreis_special_quattro_formaggi = SpecificSpice.create(chef=andrei, recipe=quattro_formaggi, oregano=True, love=True)\nprint andreis_special_quatro_formaggi['love'] # prints True\n```\n\n### Callbacks\n\n```python\nfrom remodel.models import Model\n\nclass Shirt(Model):\n    def after_init(self):\n        self.wash()\n\n    def wash(self):\n        print 'Gotta wash a shirt after creating it...'\n```\n\nor\n\n```python\nfrom remodel.models import Model, after_save\n\nclass Prize(Model):\n    @after_save\n    def brag(self):\n        print 'I just won a prize!'\n```\n\n### Custom table name\n\n```python\nclass Child(Model):\n    table_name = 'kids'\n\nprint Child.table_name # prints 'kids'\n```\n\n### Custom model queries\n\n```python\nimport rethinkdb as r\n\nclass Celebrity(Model):\n    pass\n\nCelebrity.create(name='george clooney')\nCelebrity.create(name='kate winslet')\nupper = Celebrity.map({'name': r.row['name'].upcase()}).run()\nprint list(upper) # prints [{u'name': u'GEORGE CLOONEY'}, {u'name': u'KATE WINSLET'}]\n```\n\n### Custom instance methods\n\n```python\nclass Child(Model):\n    def is_minor(self):\n        if 'age' in self:\n            return self['age'] \u003c 18\n\njack = Child.create(name='Jack', age=15)\njack.is_minor() # prints True\n```\n\n### Custom class methods\n\n```python\nfrom remodel.object_handler import ObjectHandler, ObjectSet\n\nclass TripObjectHandler(ObjectHandler):\n    def in_europe(self):\n        return ObjectSet(self, self.query.filter({'continent': 'Europe'}))\n\nclass Trip(Model):\n    object_handler = TripObjectHandler\n\nTrip.create(continent='Europe', city='Paris')\nTrip.create(continent='Asia', city='Shanghai')\nTrip.create(continent='Europe', city='Dublin')\nprint len(Trip.in_europe()) # prints 2\n```\n\n### Viewing object fields\n\n```python\nclass Train(Model):\n    pass\n\ntrain = Train.create(nr=12345, destination='Paris', has_restaurant=True, classes=[1, 2])\nprint train.fields.as_dict()\n# prints {u'classes': [1, 2], u'nr': 12345, u'destination': u'Paris', u'has_restaurant': True, u'id': u'd9b8d57f-5d67-4ff7-acf8-cbf7fdd65581'}\n```\n\n## Concepts\n\n### Relations\n\nRemodel supports various types of relationships:\n- has one\n- belongs to\n- has many\n- has and belongs to many\n- has many through\n\n#### Defining relations\n\nRelated models are passed as tuples in a model's definition. All other aspects, such as foreign keys, indexes, lazy relation loading and relation cache are magically handled for you.\n\nIf you need precise definition for your related models, you can pass a configuration tuple instead of the string name of your related model:\n\n```python\n    class Artist(Model):\n        has_many = (('Song', 'songs', 'id', 'song_id'), 'Concert')\n        # Tuple definition: (\u003crelated model name\u003e, \u003crelated objects accessor field\u003e, \u003cmodel key\u003e, \u003crelated model key\u003e)\n```\n\n\u003e One important thing to notice is that reverse relationships are **not automatically ensured** if only one end of the relationship is defined. This means that if ``Artist has_many Song``, ``Song belongs_to Artist`` is not automatically enforced unless explicitly defined.\n\n#### Using relations\n\nAssigning `has_one` and `belongs_to` objects doesn't mean that they are persisted. You need to manually call `save()` on them; assuming `Profile belongs_to User`:\n\n```python\nprofile['user'] = User(...)\nprofile.save()\n```\n\nOn the other side, assigning `has_many` and `has_and_belongs_to_many` objects automatically persist them, so there is no need for you to call `save()` on them; assuming `Shop has_many Product`:\n\n```python\nshop.add(product1, produt2)\n# No need to call save() on products!\n```\n\n\u003e Note that certain assignments of related objects can not be performed unless one (or both) of the objects is saved. You can not save a `GiftSize` with a `Gift` attached without saving the `Gift` object first (when having a `GiftSize belongs_to Gift`).\n\n## Documentation\n\nCan be found at https://github.com/linkyndy/remodel/wiki.\n\n## Motivation\n\nThe main reason for Remodel's existence was the need of a light-weight ODM for RethinkDB, one that doesn't force you to ensure a document schema, one that provides a familiar interface and one that gracefully handles relations between models.\n\n## Status\n\nRemodel is under active development and it is not _yet_ production-ready.\n\n## How to contribute?\n\nAny contribution is **highly** appreciated! See [CONTRIBUTING.md](CONTRIBUTING.md) for more details.\n\n## License\n\nSee [LICENSE](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinkyndy%2Fremodel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinkyndy%2Fremodel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinkyndy%2Fremodel/lists"}