Create a CRUD operations in RESTful API using Python, FASTAPI, SQL Alchemy, and PostgreSQL.

preview_player
Показать описание
This is a simple Appliction using Restful with FastAPI, PostgreSQL and SqlAlchemy ORM

Files
This file contains the SQLAlchemy model for a Todo and a function create_tables() to create all tables in the database.

This file imports the models module and calls the create_tables() function to create all tables in the database.

This file sets up the SQLAlchemy engine, base class for SQLAlchemy models, and the SQLAlchemy session factory.

This file contains the FastAPI application and all its routes. It uses the Todo model from the models module and the session factory from the database module to interact with the database.

API Endpoints
GET /: Returns a list of all Todos in the database.
GET /getbyid/{Todo_id}: Returns a single Todo from the database by their ID.
POST /addTodo: Adds a new Todo to the database.
PUT /update_Todo/{Todo_id}: Updates a Todo's details in the database.
DELETE /delete_Todo/{Todo_id}: Deletes a Todo from the database.
How to Run
Run unicorn main:app --reload to start the FastAPI application.

Connect with me

Directly Contact with me on email
Рекомендации по теме