Pass pyrow to sub view

I've got a master-detail view.
The master loads a resultset from a database.
This resultset is used to generate the instances property of a FlexRepeater that repeats a subview for each row.
In a first implementation I passed to the subview the key of that row; the view used that key to issue a query for that single row and get its own resultset that I kept in a custom property of the view and used to populate TextFields values via binding like

getValueAt(0, "FIELDNAME")

This worked but now I would like to explore the possibility of passing directly the row-data from the master, without having each instance of the view, that is each row to reload it's own data.

I bound the instances property of the FlexRepeater to a field with my record primary key (invoice's id) and I used the following binding script:

instances = []
for r in system.db.runPrepQuery("SELECT * FROM INVOICEROWS WHERE INVOICEID=?", [value]):		
	print str(type(r))
	instances.append({"row": r})
return instances  

My view obviously has a row parameter that should hold a representation of my row data.
Here I noticed that the type of r is PyRow.
If i check the type on the view side, that is the type of row parameter I see: JsonifiableArrayList.
The problem here is that in this process the column names get lost, so then I can only access values by index and not by column name anymore, and this is something that I would like to avoid.
(I've read somewhere that when python types are saved to properties they get 'stringified', I don't know if this is the case since I don't actally get a string but still a list.).

Finally I decided to ask here not only for finding help on this specific issue but also to get a feedback on how master-detail forms can be designed in perspective, perhaps there is a better way or a best practice that is different from this implementation of mine.

If you want to use system.db.runPrepQuery() will not be able to pass the row directly, as you have discovered.

You will instead need to build up the object.

instances = []
for row in system.db.runPrepQuery("SELECT * FROM INVOICEROWS WHERE INVOICEID=?", [value]):
    thisRow = {'column1':row['column1'],'column2':row['column2']}

or as a comprehension

instances = {"row":{'column1':row['column1'],'column2':row['column2']} for row in system.db.runPrepQuery("SELECT * FROM INVOICEROWS WHERE INVOICEID=?,[value])}

Or if you use system.db.runNamedQuery() you can set the return to be json, and then you should be able to work directly with the json object.