How to update or insert into related table in a qsqlrelationaltablemodel

118 Views Asked by At

I have this relational model

rel_model = QSqlRelationalTableModel(self, connectDB)
rel_model.setTable("person")
rel_model.setRelation(1, QSqlRelation("email", "id", "emailAddres"))
rel_model.select()

Main table holds data from the person and the related table several emails from that person. A one to many relationships. How can I update or insert emails now? I know there are insert queries but I guess there must be a way to work directly with the model.

1

There are 1 best solutions below

0
On BEST ANSWER