Skip to main content

CRUD route generator for FastAPI

Project description

fastapi-crud-generator

Tests PyPI Python License: MIT

Adds full CRUD routes to FastAPI without writing schemas, filters, or pagination by hand. Everything is generated automatically from your ORM model.

from fastapi_crud_generator import CRUDCollection
from fastapi_crud_generator.orm.sqlmodel import SQLModelAdapter

crud = CRUDCollection(orm_adapter=SQLModelAdapter(model=Article, get_session=get_session))
app.include_router(crud.get_router(prefix="/articles", tags=["articles"]))

Three lines — and five endpoints are ready with filtering, sorting, and pagination:

GET    /articles              ?title=…&published=true&sort=created_at:desc&page=1&per_page=20
GET    /articles/{article_id}
POST   /articles
PATCH  /articles/{article_id}
DELETE /articles/{article_id}

Installation

If SQLModel, SQLAlchemy, or Tortoise is already in your project:

pip install fastapi-crud-generator

To install an ORM together with the package:

pip install "fastapi-crud-generator[sqlmodel]"
pip install "fastapi-crud-generator[sqlalchemy]"
pip install "fastapi-crud-generator[tortoise]"

Documentation

mozgsml.github.io/fastapi_crud_generator

License

MIT

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_crud_generator-0.0.1.tar.gz (115.5 kB view details)

Uploaded Source

Built Distribution

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

fastapi_crud_generator-0.0.1-py3-none-any.whl (32.4 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_crud_generator-0.0.1.tar.gz.

File metadata

  • Download URL: fastapi_crud_generator-0.0.1.tar.gz
  • Upload date:
  • Size: 115.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for fastapi_crud_generator-0.0.1.tar.gz
Algorithm Hash digest
SHA256 426327c586f468c7e30ce88f63c5469912eb8035ad8226d2fea5d87fa739515f
MD5 d0074555caadf99e1116e2d771a0fa8d
BLAKE2b-256 e7116ffc57548279001209375295dfa7b6d633c4bec482fb26e752ab4495424b

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastapi_crud_generator-0.0.1.tar.gz:

Publisher: release.yml on mozgsml/fastapi_crud_generator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fastapi_crud_generator-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_crud_generator-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 de242a2610d3a6ada99c2d85cf540a49a77f62715858536fea3c7ab172e1d43b
MD5 93b6cb97e9d0fa477c30d725db4a74fe
BLAKE2b-256 b968697e645ebf5e485dcf7f28d7a6b3f075c061416d63ba001f6b5f0dbfb37e

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastapi_crud_generator-0.0.1-py3-none-any.whl:

Publisher: release.yml on mozgsml/fastapi_crud_generator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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