0
votes

Given the following model:

class User(BaseModel):
    name = TextField()

How do I execute the following sql:

SELECT name, 'hello' as foo
FROM user

I've found that I can use peewee.Alias, but I'm not sure if this is the ideal approach:

>>> print(User.select(User.name, Alias('hello', 'foo'))
SELECT "t1"."name", 'hello' AS "foo" FROM "users" AS "t1"

Is there an official way to do this?