Tags
Note
This post is a thought. It's a short note that I make about someone else's content online. Learn more about the process thoughts
Here's my thought on ๐ญ python - Concepts of backref and back_populate in SQLalchemy? - Stack Overflow
Today I came across some sqlalchemy models that created some relationships, some used backref
some used back_populates
. I was stumped why, I had never came accross backref
before and I felt skill issues sinking in.
backref is considered legacy
https://docs.sqlalchemy.org/en/14/orm/backref.html
As stated in the sqlalchemy docs, backref is a legacy feature. Its shorthand to creating relationships between parent and child, but only adding it to the parent. While this is simpler it introduces some invisible magic.
This post was a thought by Waylon Walker see all my thoughts at https://waylonwalker.com/thoughts