📜  flask sqlalchemy 查询特定列 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:01.709000             🧑  作者: Mango

代码示例1
## You can use the with_entities() method to restrict which columns you'd like to return in the result. (documentation)

result = SomeModel.query.with_entities(SomeModel.col1, SomeModel.col2)

## Depending on your requirements, you may also find deferreds useful. They allow you to return the full object but restrict the columns that come over the wire.