Skip to content
FastAPI
SQL (Relational) Databases
en - English
de - Deutsch
es - español
fr - français
hi - हिन्दी
ja - 日本語
ko - 한국어
pt - português
ru - русский язык
tr - Türkçe
uk - українська мова
zh - 简体中文
zh-hant - 繁體中文
Search
fastapi/fastapi
FastAPI
Features
Learn
Reference
Resources
About
Release Notes
FastAPI
fastapi/fastapi
FastAPI
Features
Learn
Python Types Intro
Concurrency and async / await
Tutorial - User Guide
First Steps
Path Parameters
Query Parameters
Request Body
Query Parameters and String Validations
Path Parameters and Numeric Validations
Query Parameter Models
Body - Multiple Parameters
Body - Fields
Body - Nested Models
Declare Request Example Data
Extra Data Types
Cookie Parameters
Header Parameters
Cookie Parameter Models
Header Parameter Models
Response Model - Return Type
Extra Models
Response Status Code
Form Data
Form Models
Request Files
Request Forms and Files
Handling Errors
Path Operation Configuration
JSON Compatible Encoder
Body - Updates
Dependencies
Classes as Dependencies
Sub-dependencies
Dependencies in path operation decorators
Global Dependencies
Dependencies with yield
Security
Security - First Steps
Get Current User
Simple OAuth2 with Password and Bearer
OAuth2 with Password (and hashing), Bearer with JWT tokens
Middleware
CORS (Cross-Origin Resource Sharing)
SQL (Relational) Databases
SQL (Relational) Databases
On this page
Install
SQLModel
Create the App with a Single Model
Create Models
Create an Engine
Create the Tables
Create a Session Dependency
Create Database Tables on Startup
Create a Hero
Read Heroes
Read One Hero
Delete a Hero
Run the App
Update the App with Multiple Models
Create Multiple Models
HeroBase
- the base class
Hero
- the
table model
HeroPublic
- the public
data model
HeroCreate
- the
data model
to create a hero
HeroUpdate
- the
data model
to update a hero
Create with
HeroCreate
and return a
HeroPublic
Read Heroes with
HeroPublic
Read One Hero with
HeroPublic
Update a Hero with
HeroUpdate
Delete a Hero Again
Run the App Again
Recap
Bigger Applications - Multiple Files
Stream JSON Lines
Server-Sent Events (SSE)
Background Tasks
Metadata and Docs URLs
Frontend
Static Files
Testing
Debugging
Advanced User Guide
Stream Data
Path Operation Advanced Configuration
Additional Status Codes
Return a Response Directly
Custom Response - HTML, Stream, File, others
Additional Responses in OpenAPI
Response Cookies
Response Headers
Response - Change Status Code
Advanced Dependencies
Advanced Security
OAuth2 scopes
HTTP Basic Auth
Using the Request Directly
Using Dataclasses
Advanced Middleware
Sub Applications - Mounts
Behind a Proxy
Templates
WebSockets
Lifespan Events
Testing WebSockets
Testing Events: lifespan and startup - shutdown
Testing Dependencies with Overrides
Async Tests
Settings and Environment Variables
OpenAPI Callbacks
OpenAPI Webhooks
Including WSGI - Flask, Django, others
Generating SDKs
Advanced Python Types
JSON with Bytes as Base64
Strict Content-Type Checking
FastAPI CLI
Editor Support
Deployment
About FastAPI versions
FastAPI Cloud
About HTTPS
Run a Server Manually
Deployments Concepts
Deploy FastAPI on Cloud Providers
Server Workers - Uvicorn with Workers
FastAPI in Containers - Docker
How To - Recipes
General - How To - Recipes
Migrate from Pydantic v1 to Pydantic v2
GraphQL