Skip to main content

Small, but usefull library for interaction with Ormar ORM

Project description

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 found exceptions

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastapi-ormar-utilities-0.1.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

fastapi_ormar_utilities-0.1.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file fastapi-ormar-utilities-0.1.0.tar.gz.

File metadata

  • Download URL: fastapi-ormar-utilities-0.1.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for fastapi-ormar-utilities-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0d7611a76003f517de904bdb502df0c79204bbb0cdc007fb54383600350581c9
MD5 95e0d758474bf35a7db99a48b0dfb705
BLAKE2b-256 b54f04af48b71ab7885595faea26706fca8514bfd7c3c6f5f3dd453748d967a8

See more details on using hashes here.

File details

Details for the file fastapi_ormar_utilities-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fastapi_ormar_utilities-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for fastapi_ormar_utilities-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a30c814add3c90ce1a32732f8109b8243e76f33e6e9c5ee490f403332d98c618
MD5 ebc709d8bc6c6fb869cb59a89d1d95d5
BLAKE2b-256 f0690390019e9a5a433aa6a5eb0fc52721c9ca0f5232f00bd84cc0437c53d05a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page