{"id":13502190,"url":"https://github.com/rochacbruno-archive/OrientEngine","last_synced_at":"2025-03-29T10:32:48.943Z","repository":{"id":80832308,"uuid":"21675200","full_name":"rochacbruno-archive/OrientEngine","owner":"rochacbruno-archive","description":"A Python Object-Graph-Document-Mapper for working with OrientDB ","archived":false,"fork":false,"pushed_at":"2014-11-15T16:45:11.000Z","size":188,"stargazers_count":12,"open_issues_count":1,"forks_count":0,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-24T20:42:53.852Z","etag":null,"topics":[],"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/rochacbruno-archive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-10T01:43:05.000Z","updated_at":"2021-02-11T17:32:04.000Z","dependencies_parsed_at":"2023-02-27T15:45:45.302Z","dependency_job_id":null,"html_url":"https://github.com/rochacbruno-archive/OrientEngine","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rochacbruno-archive%2FOrientEngine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rochacbruno-archive%2FOrientEngine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rochacbruno-archive%2FOrientEngine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rochacbruno-archive%2FOrientEngine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rochacbruno-archive","download_url":"https://codeload.github.com/rochacbruno-archive/OrientEngine/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246174207,"owners_count":20735406,"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":[],"created_at":"2024-07-31T22:02:05.360Z","updated_at":"2025-03-29T10:32:48.418Z","avatar_url":"https://github.com/rochacbruno-archive.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"OrientEngine\n============\n\nA Python Object-Graph-Document-Mapper for working with OrientDB \n\n\n\u003e This project is a META-Project using the RDD (Readme Driven Development) process.\n\n\n- Inspired by [MongoEngine](http://github.com/mongoengine) \n- Based in [PyOrient](https://github.com/rochacbruno/pyorient)\n\n\nThe idea \n========\n\nThere is already awesome projects to work with Python and OrientDB, BulbFlow + Rexter is the most used tools, but they use HTTP/REST interface which is great but sometimes is slow and unstable (depending on your stack). \n\nUsing PyOrient Driver is really faster!\n\nOrientEngine will provide **Vertex, Edge, Class and Cluster** classes to be extended in order to create Graph and Document database representation.\n\n```python\n\n#### edges.py\nfrom orientengine import Edge, InEdgeInterface, OutEdgeInterface IntProperty\n\nclass Eat(Edge):\n    amount = IntProperty()\n    \n    \nclass Eater(OutEdgeInterface):\n    action = 'eat'\n    action_plural = 'eats'  # there is also get_plural_action and get_singular_action if it needs to be dynamic\n    edge = Eat\n    validators = []\n    \n    def link(self,):\n        # optionally you can override the out link method\n    \nclass Eatable(InEdgeInterface):\n    related_names = ('eaters', 'who_eats')  # multiple terms can be used\n    edge = Eat\n    validators = []\n    \n    def link(self,):\n        # optionally you can override the in link method\n    \n#### vertices.py\n\nfrom orientengine import Vertex, StringProperty\nfrom .edges import Eatable, Eater\n\nclass Animal(Vertex, Eater): # Can eat Out\n    specie = StringProperty()\n    name = StringProperty()\n\nclass Food(Vertex, Eatable): # Can be eated In\n    color = StringProperty()\n    name = StringProperty()\n\n#### SHELL\n\n\u003e\u003e\u003e import orientengine\n\u003e\u003e\u003e orientengine.connect(uri=\"localhost:2424\", db=\"animals\", user=\"admin\", password=\"12345\")\n\u003e\u003e\u003e from vertices import Animal, Food\n\u003e\u003e\u003e rat = Animal(specie='rodent', name='rat')\n\u003e\u003e\u003e man = Animal(specie='human', name='man')\n\u003e\u003e\u003e pea = Food(color='green', name='pea')\n\n\n# define some links (edges) \n# on each vertex\n\u003e\u003e\u003e rat.eat(pea)\n\u003e\u003e\u003e man.eat(pea, amount=30)\n\n# or extending another vertex \"in\" connection\n\n\u003e\u003e\u003e pea.eaters.extend(rat, man)\n\n# or a vertex can eat any foods at the same time\n\u003e\u003e\u003e man.eats([pea, corn, rice, tofu])\n\n\n# Who eats peas?\n# Starting by the pea Vertex\n\u003e\u003e\u003e pea.eaters\n[\u003cOrientRecord(rat)\u003e, \u003cOrientRecord(man)\u003e, ...]\n\n# or starting by Animal class\n\u003e\u003e\u003e Animal.objects(eats=pea) or Animal.objects(who_eats=pea)\n[\u003cOrientRecord(rat)\u003e, \u003cOrientRecord(man)\u003e, ...]\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frochacbruno-archive%2FOrientEngine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frochacbruno-archive%2FOrientEngine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frochacbruno-archive%2FOrientEngine/lists"}