Integration between the Quart web framework and the Peewee ORM through the Peewee-AIO
Project description
Quart-Peewee
Integration between the Quart web framework and the Peewee ORM through the Peewee-AIO
Installation
pip install quart-peewee
Usage
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()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
quart_peewee-0.1.1.tar.gz
(2.4 kB
view details)
Built Distribution
File details
Details for the file quart_peewee-0.1.1.tar.gz
.
File metadata
- Download URL: quart_peewee-0.1.1.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7e640d59c814cb63831eaa87620a98b13f229cdb87e1b29d475a0344625ef08 |
|
MD5 | 909e78a337c8a1d76b1a2b5fb2bebfef |
|
BLAKE2b-256 | 9509ffc65d6ccec017294ef21218aefad551ab48fe5f3fec27a28fe645d1f9b3 |
File details
Details for the file quart_peewee-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: quart_peewee-0.1.1-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6265a7347fe7bba19c93bd7be2438250e9b0925cded6f486c1257258ab827573 |
|
MD5 | 0b82a88bd2248881cfddf2f7e66dff27 |
|
BLAKE2b-256 | fa18bb8605da88a2a99f3d7113d1e89641fd9fd39cf7cc8e3d4b1e7b27617bc0 |