Skip to main content

A base repository for FastAPI projects, inspired by Ruby on Rails' Active Record and Ransack.

Project description

FastAPI Repository

A base repository for FastAPI projects, inspired by Ruby on Rails' Active Record and Ransack. It provides a simple, intuitive interface for data access in asynchronous applications using SQLAlchemy.

Features

  • Async-first: Designed for modern asynchronous Python.
  • Simple CRUD: find, create, update, destroy methods out of the box.
  • Powerful Filtering: Use Ransack-style operators (__icontains, __gt, etc.) for complex queries.
  • Eager & Lazy Loading: Control relationship loading with joinedload and lazyload.
  • Default Scoping: Apply default conditions to all queries.

Installation

pip install fastapi-repository

Quick Start

from fastapi_repository import BaseRepository
from sqlalchemy.ext.asyncio import AsyncSession
from .models import User

class UserRepository(BaseRepository):
    def __init__(self, session: AsyncSession):
        super().__init__(session, model=User)

Documentation

For a complete guide, including all available methods, advanced filtering, and default scoping, please see the full documentation.

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_repository-0.0.4.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastapi_repository-0.0.4-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_repository-0.0.4.tar.gz.

File metadata

  • Download URL: fastapi_repository-0.0.4.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for fastapi_repository-0.0.4.tar.gz
Algorithm Hash digest
SHA256 92a9bd0ce6bb2d033eb18814b217ac0b69a261b89b935b10736c4ee516f3516b
MD5 099e5aea5fa971e3234505c7b843fe3d
BLAKE2b-256 4287566b1cc0e7792a57cb9d2203b2b02ff145e1b42e7cd29a06f7037bde4c71

See more details on using hashes here.

File details

Details for the file fastapi_repository-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_repository-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7d453a7e82e01e3383a083cdc5c60e9dfbac2e0c7f4e62db278e58789ccff63b
MD5 ac7d49dba2e5ba13a0be128ba6ee9c27
BLAKE2b-256 e9f54d9a24e9d0493b4709f697d87d8e8ab13a833c74dfccbf1bc348828a391e

See more details on using hashes here.

Supported by

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