Skip to content

thirdygayares/fastapi_postgres_connection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

FastAPI + PostgreSQL CRUD (SQLModel + psycopg)

A simple FastAPI + PostgreSQL CRUD starter project using SQLModel and psycopg.
This repo includes an employee table example and basic endpoints to Create (POST) and Read (GET) employees, tested via Swagger UI.

Full tutorial (step-by-step guide):
https://thirdygayares.com/FastAPI/how-to-connect-fastapi-to-postgres


Features

  • FastAPI REST API
  • PostgreSQL database connection (psycopg)
  • SQLModel ORM models
  • CRUD endpoints:
    • GET /employees – fetch all employees
    • POST /employees – create an employee
  • Swagger Docs: http://127.0.0.1:8000/docs

Prerequisites

  • Python 3.10+ (recommended)
  • PostgreSQL installed and running

Install Dependencies

pip install fastapi sqlmodel psycopg uvicorn

About

FastAPI + PostgreSQL CRUD tutorial using SQLModel & psycopg (GET/POST). Includes Swagger testing and sample employee table.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Contributors

Languages