coleifer/peewee — Issue #19: Investigate selecting related fields
Author: coleifer
Created: 2011-11-25 20:05:33+00:00
State: open

Would be nice to be able to populate (or partially populate) instances of related objects when querying. Example would be querying a list of blog entries and wanting to additionally select the 'name' of the blog -- this can be done in 1 query with a join.

It shouldn't be too hard... related models can be queried passing a dictionary to Model.select() -- need to add the logic to the QueryResultWrapper. Looking at the returned rows and converting them into a dictionary may not work here if column names collide, so might need to list the columns and assign based on index.