Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI-SQLAlchemy

Databases ---- Any relational database ---ORM Library ---- SQLAlchemy Structure ---- create_user ---> UserRequest(Schema)---> Database User (Model)---> create

        <------create user data------>

Database checklist

  1. Database Definition ------ database.py

  2. model Definition ------ models.py

  3. Create database ----- main.py

  4. schema definition ---- schemas.py

  5. ORM functionality ---- db_user.py

  6. API functionality ---- user.py

         <-----Process Overview----->
    
  7. Import required libraries : sqlalchemy, passlib, bcrypt

  8. Create database definition and run it in main.py

  9. Create database models (tables)

  10. Create functionality to write to database

  11. Create schemas: a. Data from user: UserBase b. Response to user : UserDisplay

  12. Create API operation

         <------CRUD Operations----->
    
  13. Create

  14. Read

  15. Update

  16. Delete

         <----- Relationship ----->
    
  17. Retrieve elements from multiple tables in a single request.

  18. Define relationship in models.

  19. Add the elements we want to retrieve in schemas

         <-----------Other Concepts Overview------------->
    
  20. Error Handling --- Notify a client of an error. Raising an exception anywhere stops the code from running.

    HTTP Status Codes:

    • 1XX : INFORMATIONAL
    • 2XX : SUCCESS
    • 3XX : REDIRECTION
    • 4XX : CLIENT ERROR
    • 5XX : SERVER ERROR

    Custom Exception

    Provide exception handler

  21. Custom Response

    • Standard response is a model, list, database,, dict etc
    • We can customize trhe Response object
    • No data conversion (return Response(content=dat, media_type="text/html))
  22. Headers

    • Add headers in request function definition
    • Automatic conversion between _ and -
    • List of headers
    • Provide custom response headers
  23. Cookies

  24. Form data

  25. CORS

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages