# Quart-Peewee
Integration between the [Quart](https://github.com/pallets/quart) web framework and the [Peewee ORM](https://github.com/coleifer/peewee) through the [Peewee-AIO](https://github.com/klen/peewee-aio)
## Installation
```
pip install quart-peewee
```
## Usage
```python
from peewee_aio.fields import CharField
from quart import Quart, request
from quart_peewee import QuartPeewee
app = Quart(__name__)
db = QuartPeewee("aiosqlite:///app.db")
db.init_app(app)
class User(db.Model):
name = CharField(unique=True)
@app.before_serving
async def before_serving():
await db.create_tables()
@app.route("/create_user", methods=["POST"])
async def create_user():
data = await request.get_json(force=True)
await User.create(name=data["name"])
return ""
@app.route("/get_users", methods=["GET"])
async def get_users():
return await User.select().dicts()
@app.route("/delete_user", methods=["DELETE"])
async def delete_user():
data = await request.get_json(force=True)
await User.delete().where(User.name == data["name"])
return ""
if __name__ == "__main__":
app.run()
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Mystic-Mirage/quart-peewee",
"name": "quart-peewee",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "peewee,quart,asyncio,trio,orm",
"author": "Mystic-Mirage",
"author_email": "mm@m10e.net",
"download_url": "https://files.pythonhosted.org/packages/95/09/ffc65d6ccec017294ef21218aefad551ab48fe5f3fec27a28fe645d1f9b3/quart_peewee-0.1.1.tar.gz",
"platform": null,
"description": "# Quart-Peewee\n\nIntegration between the [Quart](https://github.com/pallets/quart) web framework and the [Peewee ORM](https://github.com/coleifer/peewee) through the [Peewee-AIO](https://github.com/klen/peewee-aio)\n\n## Installation\n\n```\npip install quart-peewee\n```\n\n## Usage\n\n```python\nfrom peewee_aio.fields import CharField\nfrom quart import Quart, request\nfrom quart_peewee import QuartPeewee\n\napp = Quart(__name__)\ndb = QuartPeewee(\"aiosqlite:///app.db\")\ndb.init_app(app)\n\n\nclass User(db.Model):\n name = CharField(unique=True)\n\n\n@app.before_serving\nasync def before_serving():\n await db.create_tables()\n\n\n@app.route(\"/create_user\", methods=[\"POST\"])\nasync def create_user():\n data = await request.get_json(force=True)\n await User.create(name=data[\"name\"])\n return \"\"\n\n\n@app.route(\"/get_users\", methods=[\"GET\"])\nasync def get_users():\n return await User.select().dicts()\n\n\n@app.route(\"/delete_user\", methods=[\"DELETE\"])\nasync def delete_user():\n data = await request.get_json(force=True)\n await User.delete().where(User.name == data[\"name\"])\n return \"\"\n\n\nif __name__ == \"__main__\":\n app.run()\n```\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Integration between the Quart web framework and the Peewee ORM through the Peewee-AIO",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://github.com/Mystic-Mirage/quart-peewee",
"Repository": "https://github.com/Mystic-Mirage/quart-peewee"
},
"split_keywords": [
"peewee",
"quart",
"asyncio",
"trio",
"orm"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fa18bb8605da88a2a99f3d7113d1e89641fd9fd39cf7cc8e3d4b1e7b27617bc0",
"md5": "0b82a88bd2248881cfddf2f7e66dff27",
"sha256": "6265a7347fe7bba19c93bd7be2438250e9b0925cded6f486c1257258ab827573"
},
"downloads": -1,
"filename": "quart_peewee-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0b82a88bd2248881cfddf2f7e66dff27",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 2884,
"upload_time": "2024-01-07T10:48:37",
"upload_time_iso_8601": "2024-01-07T10:48:37.122367Z",
"url": "https://files.pythonhosted.org/packages/fa/18/bb8605da88a2a99f3d7113d1e89641fd9fd39cf7cc8e3d4b1e7b27617bc0/quart_peewee-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9509ffc65d6ccec017294ef21218aefad551ab48fe5f3fec27a28fe645d1f9b3",
"md5": "909e78a337c8a1d76b1a2b5fb2bebfef",
"sha256": "b7e640d59c814cb63831eaa87620a98b13f229cdb87e1b29d475a0344625ef08"
},
"downloads": -1,
"filename": "quart_peewee-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "909e78a337c8a1d76b1a2b5fb2bebfef",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 2405,
"upload_time": "2024-01-07T10:48:38",
"upload_time_iso_8601": "2024-01-07T10:48:38.553645Z",
"url": "https://files.pythonhosted.org/packages/95/09/ffc65d6ccec017294ef21218aefad551ab48fe5f3fec27a28fe645d1f9b3/quart_peewee-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-07 10:48:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Mystic-Mirage",
"github_project": "quart-peewee",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "quart-peewee"
}