SUM subquery
```python

subq = (MyEntity
        .select(MyEntity.value_1)
        .where((MyEntity.ClientId == i) | (MyEntity.date == z)))
        .alias('subquery'))
MyEntity.select(fn.MAX(subq.c.value_1)).from_(subq)
```
I am working on a formula-based application, which each function contructs a piece of the SQL query that will be executed. In other words, each function is a formula, which can call other formulas.

For example:

```
class Formulas():
    def formula_piece_1(self, i, z):
        return (MyEntity.select(MyEntity.value_1).where((MyEntity.ClientId == i) | (MyEntity.date == z))).alias('subquery')

    def formula_piece_2(self, i, j):
        return MyEntity.select(fn.MAX(self.formula_piece_1(i, j).select(MyEntity.value_1)))

    # I'd have thousands of functions like these, that could be combined in any order. 

f = Formulas()
result = f.formula_piece_2(12, date(2016, 1, 1))
```

This is the query I was expecting:

```
SELECT MAX (subquery.value_1)
FROM (
  SELECT "t1"."value_1"
           FROM "my_entity" AS "t1"
           WHERE (("t1"."client_id" = 12) OR ("t1"."date" = '2016-01-01'))
) subquery
```

Instead I got this:
```
SELECT MAX
       (
         SELECT "t1"."value_1"
         FROM "my_entity" AS "t1"
         WHERE (("t1"."client_id" = 12) OR
               ("t1"."date" = '2016-01-01'))
       )
FROM "my_entity" AS "t1"
```

What would be the correct way of doing it? 