Is it possible to load multiple JOINed models using a RawQuery?
As far as I understand, [`generate_column_map()`](https://github.com/coleifer/peewee/blob/65dbfc5b3b406278df15d55bd48dbfc4ab6f7d6f/peewee.py#L2205) generates a list containing every field in every model mentioned in `select()`, in the same order as they are defined in classes. Can I consider this a defined behavior? If yes, does it mean that I can just inherit from `RawQuery` and somehow force it to use the [`AggregateQueryResultWrapper`](https://github.com/coleifer/peewee/blob/65dbfc5b3b406278df15d55bd48dbfc4ab6f7d6f/peewee.py#L2316) in order to use results of my own query, and that I _do not need_ to use some specific table aliases?
 No, it doesn't work because `AggregateQueryResultWrapper` also needs `_selects` and `_joins` fields which exist only in `SelectQuery` (and `RawQuery` is not a `SelectQuery`). :-(
 By the way, is there any way to add a custom field to a model in `RawQuery`? E.g. field named `level`, for walking through a recursive result.
 `RawQuery` does not support any fancy related-instance juju. It will simply patch all attributes returned by the cursor onto the model instance (or the dictionary or tuple if you're using .dicts() or .tuples()). There is not enough information available to peewee to generate the graph of joined models reliably.

You can, of course, write a wrapper that does the transformations you want.

Alternatively you can use the regular SelectQuery type of query, which supports traversing the model graph to reconstruct joined instances.

Yes, you can add whatever attributes you want with both RawQuery and SelectQuery.

For example:

``` python
class User(Model):
    username = CharField()

users = User.select(User.username, fn.LOWER(User.username).alias('all_lower_username'))
for user in users:
    print user.all_lower_username

users = User.raw('SELECT username, LOWER(username) AS all_lower_username FROM user')
# same as above.
```
 Please respond if the above did not address your question and I'll re-open to discuss further.
 > ``` sql
> python = User.raw('SELECT username, LOWER(username) AS all_lower_username FROM user')
> ```

I don't understand where will the `all_lower_username` go here? Will it become available as `user.all_lower_username` or something?
 Yes, user.all_lower_username

If yes, how should I write the query, which aliases to use for rows?

For example, I want to load a `Site` object with joined `Page` objects which should be loaded using a custom recursive query.
