Thank you SO much for this! I thought my relationships were incorrect, but I was just calling them wrong in my template. I didn't understand backref. You made it very clear!
hello thanks for the video! I have a question, in the sqlalchemy documentation it shows that its possible to insert Owner and Pet in the same commit. Can I do that with Flask-SQLalchemy? I've been trying, but it throws me an error, because the owner doesn't have an id when the insert operation starts.
Suppose I want to create a relationship with say an item(having some quantity) and User. and store the owner of the item of the User as well as the quantity of the item. Any idea How can you do it? Is there any to store like tuples in a column of db?
thank you very much, I could understand what does it mean backref, but i saw you didnt out the lazy argument in the parent class, why that? is it optional ?
Please keep your clear and calm way of explaining as you did in so many previous videos. This video is rushing just as most of the other content providers do on you tube. your previous tempo was perfect, why start to copy their bad habits? :-)
Hey I have a question. What if the child component is in a separate model file..then how we will write and connect parent and child classes. Example :-- in groups_model.py i have a db model having id ,and name, and in another file access.py I have id and is_admin .. now i want to connect and map the user according to is_admin's content... how can i connect so ? Please help. Thanks
i have problem to search a text in serialized json in my table (let say i just want search by keyword then the keyword is contained in serialized json) , anybody have any thoughts bout this?
It might best to write raw SQL queries for this. If you're using Postgres, the queries themselves can contain things to search JSON. If you're using a database like SQlite, you'll have to parse the results somehow in Python.
@@prettyprinted thanks for the responses, looks like Postgres has better solutions in terms of code simplicity and performance, will definitely give it a try, thanks
using deprecated backref in 2022. I feel bad for the people mislead by this video, which is nothing more than some lazy Googling. At least find up to date code smh.
@@madmax6943 back_populates = allows for more complex relationships and clearly shows them but requires one more line of code. backref= becomes confusing and limited to very simple schema. Both are bi-directional and it seems like both of these are outdated but "supported" (SQLAlchemy 1.3). SQLAlchemy 2.0 is current and uses mapped_columns() or more complex mapped entries for ORM. Regardless using back_populates allowed me to have a child table within another child table which was my goal. For any more advanced projects learning the 2.0 framework is probably best for anyone else out there struggling.
best explanation so far concerning flask sqlalchemy relationships on RUclips.
Thank you SO much for this! I thought my relationships were incorrect, but I was just calling them wrong in my template. I didn't understand backref. You made it very clear!
saved my 2 hours thank you
As always, your videos explain everything as clear as water, thank you for sharing them!!
You're welcome!
FINALLY someone explains backref!
That was helpful. Much easier to understand with those artificial fields
bro you are going to heaven !! thank you
underrated
This is the best explanation I ever seen thanks
Could have been explained any better. Thanks a lot, best of luck G 💯
Thanks for the video. That's really help me
Awesome content Anthony. This really cleared up querying relationships for me.
Great tutorial! Thank you
Thanks anthony
Great video. The dog's name kept throwing me!!
Thanks for watching!
Thank you so much man, you really helped me, I definitely gonna check out your course. Thanks again.
Extremely helpful, thank you!
from where do you see the database after doing create_all()??
This is great, thank you.
Awesome video thank you!
I am not able to see the foreign key in place using the GUI, am I doing something wrong?
Excellent content!!
hello thanks for the video! I have a question, in the sqlalchemy documentation it shows that its possible to insert Owner and Pet in the same commit. Can I do that with Flask-SQLalchemy? I've been trying, but it throws me an error, because the owner doesn't have an id when the insert operation starts.
Thank you❤
You're welcome!
I'm able to insert a pet with some random owner_id that doesn't exist in user.id! means foreign key is not working! Why?
Suppose I want to create a relationship with say an item(having some quantity) and User.
and store the owner of the item of the User as well as the quantity of the item.
Any idea How can you do it?
Is there any to store like tuples in a column of db?
thank you very much, I could understand what does it mean backref, but i saw you didnt out the lazy argument in the parent class, why that? is it optional ?
Question, what happens if you post it to an owner which doesn't exist?
Great content :), really helped me.
Can you make some videos on sqlalchemy with FastAPI?
fantastic
Please keep your clear and calm way of explaining as you did in so many previous videos. This video is rushing just as most of the other content providers do on you tube. your previous tempo was perfect, why start to copy their bad habits? :-)
Hey I have a question. What if the child component is in a separate model file..then how we will write and connect parent and child classes.
Example :-- in groups_model.py i have a db model having id ,and name,
and in another file access.py I have id and is_admin ..
now i want to connect and map the user according to is_admin's content... how can i connect so ?
Please help. Thanks
add from model import * in access.py
and add from access import Access in groups_model.py should probably work.
nice video.
Thanks for watching!
i have problem to search a text in serialized json in my table (let say i just want search by keyword then the keyword is contained in serialized json) , anybody have any thoughts bout this?
It might best to write raw SQL queries for this. If you're using Postgres, the queries themselves can contain things to search JSON. If you're using a database like SQlite, you'll have to parse the results somehow in Python.
@@prettyprinted thanks for the responses, looks like Postgres has better solutions in terms of code simplicity and performance, will definitely give it a try, thanks
Is this Bi-directional?
how have you displayed the database ?
Looks like a tool such as DBeaver
use "DB Browser for SQLite"
using deprecated backref in 2022. I feel bad for the people mislead by this video, which is nothing more than some lazy Googling. At least find up to date code smh.
So if it's deprecated what should I use instead?
@@madmax6943 back_populates = allows for more complex relationships and clearly shows them but requires one more line of code. backref= becomes confusing and limited to very simple schema. Both are bi-directional and it seems like both of these are outdated but "supported" (SQLAlchemy 1.3). SQLAlchemy 2.0 is current and uses mapped_columns() or more complex mapped entries for ORM. Regardless using back_populates allowed me to have a child table within another child table which was my goal. For any more advanced projects learning the 2.0 framework is probably best for anyone else out there struggling.
@@madmax6943 back_populates