fastalchemy

A SQLAlchemy middleware for FastAPI


Keywords
fastapi, middleware, sqlalchemy, plugin
License
MIT
Install
pip install fastalchemy==0.1.3

Documentation

FastAlchemy

Build Status codecov

SQLAlchemy Middleware for FastAPI inspired by the official tutorial.

Install

pip install fastapi fastalchemy

Features

  • Super-easy configuration: simply put database.py and models.py files in your project folder with the following code.
from fastapi import FastAPI
from fastalchemy import SQLAlchemyMiddleware, db

from models import User

app = FastAPI()
app.add_middleware(SQLAlchemyMiddleware)

@app.get('/users')
def get_users():
    return db.query(User).order_by(User.id).all()

Details

Please peek tests/app folder if you want to know the way to create database.py and models py.