Рет қаралды 24,423
This video explains the steps involved in adding a SQLite database to your FastAPI application, and walks through the process of adding SQLAlchemy models and a FastAPI Dependency to allow your FastAPI routes to interact with the database.
A FastAPI startup event is also demonstrated, in order to load dummy data into the database.
Finally, we show how to paginate data with SQLAlchemy, and integrate this with our HTMX-based frontend.
▶️ Full Playlist:
• FastAPI
📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
00:00 Intro
02:28 Database setup with SQLAlchemy
04:18 Creating SQLAlchemy model
06:06 Creating the database tables
08:44 Creating FastAPI database dependency
11:00 Querying database with SQLAlchemy
11:55 FastAPI startup events
15:24 Paginating SQLAlchemy records
☕️ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲:
To support the channel and encourage new videos, please consider buying me a coffee here:
ko-fi.com/bugb...
𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮:
📖 Blog: www.bugbytes.i...
👾 Github: github.com/bug...
🐦 Twitter: / bugbytesio
📚 𝗙𝘂𝗿𝘁𝗵𝗲𝗿 𝗿𝗲𝗮𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:
HTMX CDN: htmx.org/docs/...
FastAPI docs: fastapi.tiango...
FastAPI & relational databases: fastapi.tiango...
FastAPI events: fastapi.tiango...
FastAPI headers: fastapi.tiango...
FastAPI templates: fastapi.tiango...
#fastapi #python #sqlalchemy