Skip to content

Doing CRUD operation on database using Apis (build using fastapi) and Sqlalchemy

License

Notifications You must be signed in to change notification settings

fasihmuhammadvirk/API-Using-Fastapi-SQLAlchemy-Postgres

Repository files navigation

Notes

Sort them using "Create Date 'OldestFirst' "
Link to Notes

About Repositories

In this i have created 5 Apis that do CRUD operation on the Database
I have created the database using SQLalchemy(About Sqlalchemy) and linked it with Postgressql

Setup

Follow these steps to setup this project/repository

Open Your Project Directory

The First setp is to open your Repository/Project Folder in Vs Code or any IDE.

Install and Setup Virtual Enviornment.

1. Install Virtual Enviornment
      pip3 install virtualenv
2. Create a Virtual Enviornment
2.1 Make sure you are in your project/repository folder
2.2 Create a Virtual Environment
    virtualenv env
3. Activate the Virtual Enviornment
For Macos
   source env/bin/activate
For Windows
   .\Scripts\bin\activate\
3. Deactivate the Virtual Enviornment
For Macos
   source env/bin/deactivate
For Windows
   .\Scripts\bin\deactivate

Download & Install Dependancies.

1. We need these for this Project pytest, sqlalchemy, fastapi, pydantic, uvicorn, coverage, pytest-cov
2. To install all these dependancies use this command
    pip3 pytest sqalchemy fastapi pydantic uvicorn coverage

To run Server

1. I have created all the apis in main.py and also other concepts in different files
2. To run Api server use this command
      uvicorn main:app --reload 

Test and Coverage.

1. To run Test

   pytest test_main.py         

2. For Coverage

   pytest --cov

3. For Coverage Report

   coverage report

About

Doing CRUD operation on database using Apis (build using fastapi) and Sqlalchemy

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages