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

Uploaded Python 3

File details

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

File metadata

  • Download URL: fastapi_repository-0.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 6b863d4d68c6ccfea3a7e2b76a8945ae18a8a5013354e7102ad64e821f0bd942
MD5 bfe68e60535d01d82d8af9e720670c2f
BLAKE2b-256 c7aaad07e607d3e11f97b1897191b7d4ce18088f21ff500a23cdf052570784b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastapi_repository-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0179d267e5bfafde71b1315a7f8d4648994d0c87544acfe01604b2784b8b9cec
MD5 7cc0b05b64e9e6489ba02e1b9c6613ed
BLAKE2b-256 d3112206ba10615d7cd0092a2f0dc2a7d082c2a00ab9832f4f92663bbeeb3e00

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