sanic-aioorm
===============================
version: 0.0.5
author: hsz
email: hsz1273327@gmail.com
Feature
----------------------
* simple to use, just like using flask's extension
* design to take the place of sanic-peewee
Example
-------------------------------
model.py
.. code:: python
from sanic_aioorm import AioOrm, AioModel
from peewee import Proxy, CharField
db = Proxy()
@AioOrm.regist
class User(AioModel):
username = CharField()
class Meta:
database = db
app.py
.. code:: python
from sanic import Sanic
from sanic.response import json
from sanic_aioorm import AioOrm
from ex_model import User, db
app = Sanic()
AioOrm.SetConfig(app, defaultdb="mysql://root:hsz881224@localhost:3306/test")
orm = AioOrm(app)
orm.init_proxys(defaultdb=db)
orm.create_tables(User=[{'username': "hsz"}, {'username': "jojo"}])
@app.get("/")
async def testget(request):
try:
users = await User.select()
except Exception as e:
return json({"error": str(e)})
else:
return json({"hello": [await u.to_dict() for u in users]})
@app.post("/")
async def testpost(request):
try:
users = await User.create(request.json)
except Exception as e:
return json({"error": str(e)})
else:
return json({"hello": [u.to_dict() for u in users]})
if __name__ == "__main__":
app.run(host="0.0.0.0", port=4500)
Install
--------------------------------
- ``python -m pip install sanic-aioorm``
Limitations
-----------
* only support mysql and pgsql
Metadata
Release files for sanic-aioorm 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sanic-aioorm-0.0.5.tar.gz | 5.1 kB | Without provenance | Details for sanic-aioorm-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sanic_aioorm-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for sanic_aioorm-0.0.5-py3-none-any.whl |
Total release size: 11.6 kB
Release files / sanic-aioorm-0.0.5.tar.gz
| Download URL | sanic-aioorm-0.0.5.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c2f28fe1ec9c86b8bda06381a9285cdd80d7003748a1aae4e83f7a17d2ff76fe
|
|
BLAKE2b-256 checksum How to use checksums |
42a52fe629e76e826132fec7d03709439ff40ea130f050c04ad9e8fd1d0f9dc8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / sanic_aioorm-0.0.5-py3-none-any.whl
| Download URL | sanic_aioorm-0.0.5-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
56d4509dd70ef6ce217f1a3869e2000b16f828c7c59811d3e350830fc3cea53a
|
|
BLAKE2b-256 checksum How to use checksums |
8d05a2b27b384db6aadb7194251efa0400021fda51e290708525537c3d4faf1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for sanic-aioorm 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.