FASTAPI-ORMAR-UTILITIES
Small package for better interaction with Ormar ORM.
This package makes your views cleaner
Features:
- Fully async
- Compatible with FastAPI
- In my opinion Ormar is the best ORM for FastAPI
- Support
select_related()method - Handle
Not foundexceptions
Install with pip
pip install fastapi-ormar-utilities[all]
Example usage:
from fastapi import APIRouter, Depends
from fastapi_ormar_utilities import Base
from .models import Item # import Ormar model
from .schemas import ItemCreate # import Pydantic model
router = APIRouter()
class ItemService(Base):
model = Item
@router.get('/')
async def get_items(
service: ItemService = Depends()
):
return await service.fetch_all()
@router.get('/')
async def get_items_with_related(
service: ItemService = Depends()
):
# if you want to add related field to the query
return await service.fetch_all(related_field='some_field')
@router.post('/')
async def create_item(
item_data: ItemCreate,
service: ItemService = Depends()
):
return await service.create(item_data)
Metadata
Release files for fastapi-ormar-utilities 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fastapi-ormar-utilities-0.1.1.tar.gz | 3.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastapi_ormar_utilities-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.4 kB
Release files / fastapi-ormar-utilities-0.1.1.tar.gz
| Download URL | fastapi-ormar-utilities-0.1.1.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d60740591d54ef1fbc043762c552be26f2d4208ea5e133f7105db47579088261
|
|
BLAKE2b-256 checksum How to use checksums |
0307bbdddfc777376cd6fe7afed9bee455725bb289f6f7e28cd218b209be5cd1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
|
Release files / fastapi_ormar_utilities-0.1.1-py3-none-any.whl
| Download URL | fastapi_ormar_utilities-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ddb292512a94269dc3b70e107dc40fc8a598d6128fe6bda8e5f583c6cac9ca84
|
|
BLAKE2b-256 checksum How to use checksums |
becc79b5f0fcb37a0c6d063b5f3b0aea834479b74889f0d4f075dd2685188023
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
|