Curso de FastAPI - Rest API com Python - Aula 09: Adicionar Item em Pedido e Relationship em Models

Want to learn more about our Complete Python Course? Click the link below to secure your spot in the next class: https://lp.hashtagtreinamentos.com/es... ----------------------------------------------------------------------- šŸ“ Files Used in Video: https://dlp.hashtagtreinamentos.com/p... šŸ’» Recommended video: FastAPI Course Playlist - Rest API with Python (Complete Backend)    • CursoĀ deĀ FastAPIĀ -Ā RestĀ APIĀ comĀ PythonĀ (Ba...Ā Ā  ----------------------------------------------------------------------- If you prefer the video Text format: https://www.hashtagtreinamentos.com/c... ----------------------------------------------------------------------- TO HIRE HASHTAG FOR YOUR COMPANY: https://www.hashtagtreinamentos.com/t... ----------------------------------------------------------------------- šŸš€ We've reached the ninth lesson of our FastAPI Course with Python, and now we'll take another important step in building a complete, efficient API with real business logic. You'll learn how to add items to existing orders, create schemas with Pydantic to validate item data, and connect database tables using SQLAlchemy relationships in a practical and organized way. In this lesson, we'll also apply advanced access control: only the administrator or order owner can add new items, ensuring security and consistency in API operations. All of this with permission checks within the function and clear error handling with HTTPException. Furthermore, we'll automate the order price calculation based on the added items, updating this value whenever there's a change, and using good modeling practices to keep your code clean and functional. Finally, we'll test everything in the interactive FastAPI documentation, simulating different usage scenarios. šŸ”” If you're enjoying the complete FastAPI with Python course, subscribe to the channel, like it, and activate the bell to continue following all the lessons on backend development with Python and professional APIs! ----------------------------------------------------------------------- Hashtag Programming ā–ŗ Subscribe to our channel: http://bit.ly/3c0LJQi ā–ŗ Turn on notifications (click the bell)! ā–ŗ Like our video! ----------------------------------------------------------------------- Social Media ā–ŗ Blog: https://bit.ly/2MRUZs0 ā–ŗ YouTube: http://bit.ly/3c0LJQi ā–ŗ Instagram: https://bit.ly/3o6dw42 ā–ŗ Facebook: http://bit.ly/3qGtaF2 Here in the videos on the Hashtag Programming channel, we teach several Python tips so you can develop in this programming language and create your own projects and automations! ----------------------------------------------------------------------- Class Content 00:00 Introduction to creating relationships between tables in FastAPI 01:10 How to list all orders in the system with a new route 02:28 Restrict access to the orders route with authentication and authorization 04:53 Test the new route with the admin user 06:43 Add an item to an order via an endpoint 08:46 Create the Pydantic schema for order items 11:10 Configure a POST route to add an item to an order 16:30 When should I update the order price? 19:48 Automatically update the order total when adding an item 21:35 Test the add item endpoint and check the result in the database 23:36 Create a function to calculate the total order price 24:40 Define a relationship between tables with SQLAlchemy relationship 26:07 How to use a relationship in a FastAPI model 28:45 Apply list comprehension to the price calculation function 30:00 Migrate the database with Alembic 32:00 Test the total price calculation function with items in the order 33:38 Fix a sum error in the total order price 34:43 Conclusion and next steps #python #hashtagprogramming

FastAPI Course - Rest API with Python - Lesson 10: Finalization and Schemas for endpoint responses
ā–¶ļøŽ

FastAPI Course - Rest API with Python - Lesson 10: Finalization and Schemas for endpoint responses

Python Course - Lesson 7 - Functions and Parameters
ā–¶ļøŽ

Python Course - Lesson 7 - Functions and Parameters

WORKSHOP DAY 2 | HANDS ON SESSION | Python for Economics Finance
ā–¶ļøŽ

WORKSHOP DAY 2 | HANDS ON SESSION | Python for Economics Finance

How to Start Coding | Programming for Beginners | Learn Coding | Intellipaat
ā–¶ļøŽ

How to Start Coding | Programming for Beginners | Learn Coding | Intellipaat

Python Course in 1 HOUR: Complete for Beginners (2026)
ā–¶ļøŽ

Python Course in 1 HOUR: Complete for Beginners (2026)

Aprenda de vez o que Ć© uma API com esse exemplo simples em Python
ā–¶ļøŽ

Aprenda de vez o que Ć© uma API com esse exemplo simples em Python

FastAPI Course - Rest API with Python - Class 06: Authentication, OAuth2 and JWT Tokens
ā–¶ļøŽ

FastAPI Course - Rest API with Python - Class 06: Authentication, OAuth2 and JWT Tokens

8 MUST-KNOW data processing steps - Python for data
ā–¶ļøŽ

8 MUST-KNOW data processing steps - Python for data

Python Course #01 - Become a Programmer
ā–¶ļøŽ

Python Course #01 - Become a Programmer

Python Course - Lesson 0 - Why Python? + Installation and Configuration
ā–¶ļøŽ

Python Course - Lesson 0 - Why Python? + Installation and Configuration

Basic Excel 2026 Course | Lesson 1 | FREE
ā–¶ļøŽ

Basic Excel 2026 Course | Lesson 1 | FREE

Learn APIs in 10 Minutes: Quick Guide with Practical Examples for Beginners
ā–¶ļøŽ

Learn APIs in 10 Minutes: Quick Guide with Practical Examples for Beginners

FastAPI Course - Rest API with Python - Class 08: Database Access Levels and Lazyloaded
ā–¶ļøŽ

FastAPI Course - Rest API with Python - Class 08: Database Access Levels and Lazyloaded

What does '__init__.py' do in Python?
ā–¶ļøŽ

What does '__init__.py' do in Python?

Curso BÔsico de Python - Aula 1 - Introdução ao Python
ā–¶ļøŽ

Curso BÔsico de Python - Aula 1 - Introdução ao Python

I Hacked This Temu Router. What I Found Should Be Illegal.
ā–¶ļøŽ

I Hacked This Temu Router. What I Found Should Be Illegal.

BEGINNER programmer, do THIS as SOON as POSSIBLE!
ā–¶ļøŽ

BEGINNER programmer, do THIS as SOON as POSSIBLE!

Configurando o VSCode com Python para MÁXIMA produtividade | Programação para Iniciantes
ā–¶ļøŽ

Configurando o VSCode com Python para MÁXIMA produtividade | Programação para Iniciantes

A Jane Street Software Engineering Mock Interview with Grace and Nolen
ā–¶ļøŽ

A Jane Street Software Engineering Mock Interview with Grace and Nolen