FastAPI with PostgreSQL and Docker

preview_player
Показать описание
In this video we're going to create a basic API using FastAPI alongside a PostgreSQL database that lives inside a Docker container.

Timestamps ⏳
00:00 - Prerequisites
02:14 - Creating the PostgreSQL Docker Container
06:11 - Creating the Database
09:03 - Python project setup
12:48 - Connecting the database
16:02 - Model Creation
23:03 - Schema Creation
26:14 - Building the API

The finished code can be found here:

#FastAPI #Docker #PostgreSQL
Рекомендации по теме
Комментарии
Автор

Thanks for the video. Few remarks:
1- It would be nicer if you explained what were the flags you used when configured postgres. For example, why you used `-d` (detached mode)? why it's important to set the ports inside the container.
2- Create DockerFile: better for maintenance, control over commands\versions and packaging.
3- Create `requirements.txt` for python packages, for the same reasons and integration with docker.
4- I don't recommend to rename all imported package with underscore.

Darweesh
Автор

🔴- If you enjoyed this video please leave a Like and Subscribe :)

iamrithmic
Автор

I watched this tutorial last year and it's still relevant. Great Job Rithmic.🐐

wanamuhanga
Автор

Dude I just needed this, thanks for all of your vids, they are gold

trigocuantico
Автор

a big thanks to you. this tutorial is the most understandable in youtube. it would be totally useful to see a tutorial to docker-compose!!

voloduhe
Автор

thank you so much for the tutorial ! keep up the good work ! you help people :)

Etogg_
Автор

👽 Join the Discord Server (link in the description)

iamrithmic
Автор

YOU ARE PERFECT. thank you for this tutorial

kimsspencer
Автор

Muito obrigado pelo seus ensinamentos, você me explicou com clareza e tirou a minha duvida, fico muito agradecido e me desculpe em falar em português

coghi
Автор

Great video thanks! One recommendation would be for you to put your docker and bash SQL queries in a text files to viewers don't have to copy these off the video and try and find the right section etc. Couldn't see them in your repo's readme either

timklymenko
Автор

You really helped me! Thank you very much ;D

roobsonsants
Автор

que elegancia de video, gracias por ofrecer contenido de valor

josepicon
Автор

Congratulations on 1k subscribers 🚀 well deserved

I remember you mentioned in one of your videos why you import packages with underscores, can you remind me why? 😛

farzadmf
Автор

Another great video, congrats on 1k subscribers. Could you do a video on SQLModel from Trianglo, creator of FastAPI

Lerklinten
Автор

hi rithmic, can you teach us on how to do migration in production with alembic correctly?

Thank you so much for all the fastapi tutorials 💯

alvin
Автор

How do i connect to an existing postgres database to a fastapi app running on a docker container?

aruncanra
Автор

Second the request: migration tutorial would great!

collegeinvestor
Автор

has anyone tried to connect to exisitng database using docker? I have created a database through pg admin. I have a database named Rest from public schema. I used postgres 15.3 image. When enterning the container and going to psql -U postgres I can see database Rest but I can't see any tables inside it :((

cbentvv
Автор

the command "psql -h localhost -p 5432 postgres", is it really necessary? when calling it nothing is displayed as usual in postgres bash. I got the connection without using this command! could you explain to me about?

ryansilva
Автор

What’s with the nonstandard underscore naming scheme?

astronemir
visit shbcf.ru