Python SQLAlchemy ORM - Relationship Loading Techniques

preview_player
Показать описание
Hello everyone and welcome back to another python video!
In this video I will go over various relationship loading techniques in SQLAlchemy

Check out my channel for more 😎:

Code for this video:

Check out the repo on GitHub:

Timestamps
00:00 - Intro
00:33 - Setup
01:26 - select
07:41 - selectin
10:43 - joined
13:07 - raise
15:51 - subquery
18:11 - write_only
19:25 - dynamic
22:50 - Wrapping up
23:18 - Outro

#python #pythonforbeginners #pythontutorial #pythonprogramming #python3 #pythonbegginer #pythonbeginners #automation
Рекомендации по теме
Комментарии
Автор

Thanks ZT. Simple, precise and straight to the point.
It'd be really really helpful if you'd added the perf_counter benchmark throughout to weigh the performance

AnthonyTetteh-tq
Автор

Hi ZT,
thank you for great and simple tutorials. The SQLAlch docs is really hard to read for newbie... core-way, orm-way old and new.. mostly all mixed in 1 tutorial..

Will you do also tutorial for quering with joins? Getting values from Second table when you have FK (ID from 2nd table) in Main table.

I think I set correctly but still can't get "second.name" when quering Main table

Melvi
Автор

Hi, Zeq Tech
Thanks for the video. I've been trying using SQLAlchemy ORM with mapped_column for a project of mine and I've been having a lot of issues, but your videos are helping me a lot.
Could you answer this question of mine?
For example: I inserted this data on the database
itauBank = Bank(
name=BANK_NAMES["ITAU"],
account_types=[
AccountType(
name=ACCOUNT_TYPES["CHECKING_ACCOUNT"],
account_rules=AccountRule(
withdraw_fee=1,
minimum_initial_balance=50,
),
),
AccountType(
name=ACCOUNT_TYPES["SAVING_ACCOUNT"],
account_rules=AccountRule(
withdraw_fee=3,
minimum_initial_balance=200,
),
),
],
)

How can I make a select which you get the object Bank with the name = "Itau" and only the AccounType with the name = "Checking Account"? I've already tried a lot of thinks, but I can just filter the name of the bank, but not both at the same time

MrSule
Автор

Any tips for async sqlalchemy?
Also when i do get posts i want select but when i do post where id equals blaaa i want all the relationships. What is the best strategy

tomasemilio
Автор

Nice presentation, thanks for sharing!

greob
visit shbcf.ru