Create A REST API with FastAPI, SQLAlchemy and PostgreSQL.
FastAPI is a Python framework and set of tools that allow developers to invoke commonly used functions using a REST interface.
SQLAlchemy is a package that makes it easier for Python programs to communicate with databases. Most of the time, this library is used as an Object Relational Mapper (ORM) tool, which automatically converts function calls to SQL queries and translates Python classes to tables on relational databases.
Many web, mobile, geospatial, and analytics applications use PostgreSQL as their primary data storage or data warehouse.
In this video, I build a simple REST API using the above technologies.
If you have learned from this video, please like comment , like and share.
Do not forget to subscribe to the channel for content like this in the future.
Timestamps
0:00 Introduction and project set up
2:05 Implement simple routes
3:26 Running with uvicorn
8:22 Creating a schema with Pydantic
15:56 Creating optional query parameters
19:35 Setting up PostgreSQL with SQLAlchemy
27:05 Creating database model with SQLAlchemy
39:55 Write database model to database
42:37 Create the CRUD routes
47:53 Get all items
51:24 Create an item
52:12 Setting response status code
58:09 Raising Http exceptions
1:02:28 Get one item
1:04:55 Update an item
1:10:25 Delete an item
1:18:40 Documenting the API with Swagger and Redoc
1:20:00 Wrapping Up
SOURCE CODE:
Github:
Twitter:
1 view
376
106
4 days ago 00:08:10 1
AI Agents Will Create MILLIONAIRES in 2025 – Are You Ready
4 days ago 00:04:49 1
Play To Earn🔥This New Play to Earn Game is About to Make a Lot of People RICH
5 days ago 00:02:01 1
Mission: Impossible – The Final Reckoning | Teaser Trailer (2025 Movie) - Tom Cruise
7 days ago 00:06:21 1
Richie Sambora Deep Purple cover When A Blind Man Cries LG — «Momentos»
1 week ago 00:01:00 1
Big Fails 😂😂😂
1 week ago 01:21:24 1
The Dark Exploitation of La Toya Jackson | Full Documentary (4K 2160p) | the detail.
1 week ago 00:21:40 1
La Toya Jackson On Michael’s Allegations | What Changed Her Mind? | the detail.