Flask SQLAlchemy query, specify column names
How do I specify the column that I want in my query using a model (it selects all columns by default)? I know how to do this with the sqlalchmey session: session.query(self.col1) , but how do I do it with with models? I can't do SomeModel.query() . Is there a way? David McKeone 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