如何将常量值列添加到SQLAlchemy查询响应中?

时间:2017-03-24 16:53:58

标签: sqlalchemy

获得相当于

的内容
select a, b from very_wide_table

在SQLAlchemy我可以写

VeryWideTable.query().with_entities(VeryWideTable.a, VeryWideTable.b)

等同于

select a, b, 'hello' from very_wide_table

我试过了add_columns,但它想要一个列对象,我不知道如何指定一个固定的字符串。我尝试将固定字符串添加到with_entities,但这被解释为列名。

1 个答案:

答案 0 :(得分:3)

使用literal

/proc/$pid/fd