{"id":13468846,"url":"https://github.com/sloria/PythonORMSleepy","last_synced_at":"2025-03-26T05:31:20.467Z","repository":{"id":12225823,"uuid":"14835020","full_name":"sloria/PythonORMSleepy","owner":"sloria","description":"Python ORM/ODM Examples, For The Sleepy","archived":true,"fork":false,"pushed_at":"2013-12-31T16:08:23.000Z","size":214,"stargazers_count":211,"open_issues_count":1,"forks_count":38,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-10-29T22:56:45.362Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sloria.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-01T07:07:43.000Z","updated_at":"2024-09-23T16:33:12.000Z","dependencies_parsed_at":"2022-09-23T05:04:23.504Z","dependency_job_id":null,"html_url":"https://github.com/sloria/PythonORMSleepy","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/sloria%2FPythonORMSleepy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sloria%2FPythonORMSleepy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sloria%2FPythonORMSleepy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sloria%2FPythonORMSleepy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sloria","download_url":"https://codeload.github.com/sloria/PythonORMSleepy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245597320,"owners_count":20641865,"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-31T15:01:20.229Z","updated_at":"2025-03-26T05:31:20.002Z","avatar_url":"https://github.com/sloria.png","language":"Python","readme":"# Python ORM/ODM Examples, For The Sleepy\n\nThe same RESTful API (an inventory app), implemented using different ORM/ODMs--a sort of \"Hello World\" tour of Python data mapper libraries.\n\nEach example demonstrates the syntax for declaring models as well as basic querying, inserting, updating, and deleting of records.\n\n\n## Featuring. . .\n\n**[SQLAlchemy](http://www.sqlalchemy.org/)** (Relational DBs)\n\n[Full Example](https://github.com/sloria/PythonORMSleepy/blob/master/sleepy/api_sqlalchemy.py)\n\n```python\nhour_ago  = datetime.utcnow() - timedelta(hours=1)\nrecent_items = Item.query.filter(Item.checked_out \u0026\n                                (Item.updated \u003e hour_ago)) \\\n                                .order_by(Item.updated.desc()).all()\n```\n\n**[Peewee](http://peewee.readthedocs.org/en/latest/)** (Relational DBs)\n\n[Full Example](https://github.com/sloria/PythonORMSleepy/blob/master/sleepy/api_peewee.py)\n\n```python\nhour_ago  = datetime.utcnow() - timedelta(hours=1)\nrecent_items =Item.select().where(Item.checked_out \u0026\n                                (Item.updated \u003e hour_ago)) \\\n                                .order_by(Item.updated.desc())\n```\n\n**[Mongoengine](http://mongoengine.org)** (MongoDB)\n\n[Full Example](https://github.com/sloria/PythonORMSleepy/blob/master/sleepy/api_mongoengine.py)\n\n```python\nhour_ago  = datetime.utcnow() - timedelta(hours=1)\nrecent_items = Item.objects(checked_out=True, updated__gt=hour_ago)\\\n                            .order_by(\"-updated\")\n```\n\n**[Stdnet](http://pythonhosted.org/python-stdnet/index.html)** (Redis)\n\n[Full Example](https://github.com/sloria/PythonORMSleepy/blob/master/sleepy/api_stdnet.py)\n\n```python\nhour_ago  = datetime.utcnow() - timedelta(hours=1)\nrecent_items = models.item.filter(checked_out=True, updated__gt=hour_ago)\\\n                                .sort_by(\"-updated\").all()\n```\n\n**[Pony](http://ponyorm.com/)** (Relational DBs)\n\n[Full Example](https://github.com/sloria/PythonORMSleepy/blob/master/sleepy/api_pony.py)\n\n```python\nhour_ago  = datetime.utcnow() - timedelta(hours=1)\nrecent_items = orm.select(item for item in Item\n                                if item.checked_out and\n                                    item.updated \u003e hour_ago)\\\n                                    .order_by(Item.updated.desc())[:]\n```\n\n\n. . . and more to come.\n\nEach of these was put to REST by [Flask](http://flask.pocoo.org), [Flask-Classy](http://pythonhosted.org/Flask-Classy/), and [marshmallow](http://marshmallow.readthedocs.org).\n\n## Running an example\n\nFirst, install dependencies.\n\n    $ pip install -r requirements.txt\n\nThen run the example of your choice.\n\n    $ python sleepy/api_sqlalchemy.py\n\n## Browser interface\nAn interactive browser interface is included to test out the REST API.\n\n\u003cimg src=\"https://dl.dropboxusercontent.com/u/1693233/github/inventory-api.png\" alt=\"Browser interface\"\u003e\n\nTo use the browser interface, run an example and browse to `http://localhost:5000`.\n\n## \"Why isn't  _____ included here?\"\n\nTo which I respond: Why don't you [fork](https://github.com/sloria/PythonORMSleepy/fork) this project?\n\n\n\n## License \n\n[MIT Licensed](http://sloria.mit-license.org/).\n","funding_links":[],"categories":["Python","Data validation"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsloria%2FPythonORMSleepy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsloria%2FPythonORMSleepy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsloria%2FPythonORMSleepy/lists"}