Original title: Easier way to update a row returned from .rows
Here's a surprisingly hard problem I ran into while trying to implement #239 - given a row returned by db[table].rows how can you update that row?
The problem is that the db[table].update(...) method requires a primary key. But if you have a row from the db[table].rows iterator it might not even contain the primary key - provided the table is a rowid table.
Instead, currently, you need to introspect the table and, if rowid is a primary key, explicitly include that in the select= argument to table.rows_where(...) - otherwise it will not be returned.
A utility mechanism to make this easier would be very welcome.
Original title: Easier way to update a row returned from .rows
Here's a surprisingly hard problem I ran into while trying to implement #239 - given a row returned by
db[table].rowshow can you update that row?The problem is that the
db[table].update(...)method requires a primary key. But if you have a row from thedb[table].rowsiterator it might not even contain the primary key - provided the table is arowidtable.Instead, currently, you need to introspect the table and, if
rowidis a primary key, explicitly include that in theselect=argument totable.rows_where(...)- otherwise it will not be returned.A utility mechanism to make this easier would be very welcome.