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.3.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.3-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fastapi_repository-0.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 4fb2d5acab44c0c82136ecd8102b8450483903ec112c8a2fea4bfc564c7e7408
MD5 7a2326600e7bec58a438d331721325ea
BLAKE2b-256 12e18222996329c585e6b0fe301b33b4c29296a5f193a8057ff8c15bc82e6194

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastapi_repository-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 51e255845b2877509afa2fa78d1f4cacc131e46a1afda138d2e215537164af9d
MD5 d90ec4f7458d791763aadad47c943cac
BLAKE2b-256 3d5d20a7daddaca74e83fce0c8328afd62db83e3c7c66fa016e10ad4123025f3

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