FastAPI psycopg3 Tutorial

Description

Learn how to build an API with FastAPI and psycopg3 with three different approaches:

  • No Connection Pool
  • Connection Pool
  • Async Connection Pool

Terminal

python -m venv venv
. venv/bin/activate # mac and linux
. venv/Scripts/activate # windows
pip install fastapi
pip install "uvicorn[standard]"
pip install psycopg
pip install psycopg_pool
psql -U postgres -c "create database fastapi_psycopg3"
psql -U postgres -d fastapi_psycopg3 -f v1_create_todos_table.sql