Saving new child table rows

This one sounds like an easy problem to solve, but I’m not sure how to approach it. I haven’t found anything to help in the forums even after a few hours of searching.

Here’s the code:

doc = frappe.get_doc('Str', 'STR00246')
doc.append('str_assignment', {'document_type': 'Sales Partner', 'assignment': 'TST'})

I can see that doc.append() does add a row to the str_assignment field when I view doc.str_assignment. However, upon reloading the document after, the row is gone.

How do I add a row to str_assignment and save it to the database properly?

Thanks in advance!

I figured it out - the code is correct. I was running the commands in the bench console, and save() didn’t appear to do anything. Actually, bench console requires a manual frappe.db.commit() to commit the transaction.