Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

flask sqlalchemy query specific columns

## 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.
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #flask #sqlalchemy #query #specific #columns
ADD COMMENT
Topic
Name
1+8 =