3 ms·
Interesting and very educational article. I do wonder why in the first example of inserting multiple tags with get_or_create_tag the id of 'C' suddenly changes
by shiandow 2y ago
Interesting and very educational article.
I do wonder why in the first example of inserting multiple tags with get_or_create_tag the id of 'C' suddenly changes to 4. Were some queries perhaps not run in the order they appear?
- CRConrad 2y agoI got the same impresssion, that the demo wasn't implemented as a single "clean" run. Another indication of this is that the next passage, about eliminating "bloat" from failed inserts, shows the table containing two live tuples again, not three or four as it should after the preceding example.
- haki 2y agoSince at least two people noticed, I would just say that the insert-select-insert approach was added later, after I took some inspiration from Django's implementation of get_or_create.