# Specifying column names flask sqlalcamy

**URL:** <https://discuss.python.org/t/specifying-column-names-flask-sqlalcamy/12866>\
**Category:** Python Help\
**Created:** [January 3, 2022, 12:39pm UTC](https://discuss.python.org/t/specifying-column-names-flask-sqlalcamy/12866 "2022-01-03T12:39:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![funkytwig](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/funkytwig/32/5860_2.png) [@funkytwig](https://discuss.python.org/u/funkytwig)\
**Post date:** [January 3, 2022, 12:39pm UTC](https://discuss.python.org/t/specifying-column-names-flask-sqlalcamy/12866/1 "2022-01-03T12:39:16Z")

</div>

The following works

```auto
    posts = BlogPost.query.with_entities(
        BlogPost.id, BlogPost.title, BlogPost.subtitle, BlogPost.img_url, 
        User.id, User.name
    )

```

But the following does not

```auto
    posts = BlogPost.query(
        BlogPost.id, BlogPost.title, BlogPost.subtitle, BlogPost.img_url, 
        User.id, User.name
    )

```

Cant work out why? I thought both were suposed to be equivelent.

I actualy want to do this partly so I can have a column alius, so

```auto
    posts = BlogPost.query(
        BlogPost.id, BlogPost.title, BlogPost.subtitle, BlogPost.img_url, 
        User.id, User.name.label("username")
    )

```

---

<div class="post-metadata">

**Author:** ![TobiasHT](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/tobiasht/32/23304_2.png) [@TobiasHT](https://discuss.python.org/u/TobiasHT)\
**Post date:** [January 5, 2022, 10:02pm UTC](https://discuss.python.org/t/specifying-column-names-flask-sqlalcamy/12866/2 "2022-01-05T22:02:43Z")

</div>

I think questions concerning specific libraries should be addressed to those library forums for better help, cause I don’t think everyone is totally familiar flask and sqlalchemy here.

---

<div class="post-metadata">

**Author:** ![funkytwig](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/funkytwig/32/5860_2.png) [@funkytwig](https://discuss.python.org/u/funkytwig)\
**Post date:** [January 6, 2022, 2:02pm UTC](https://discuss.python.org/t/specifying-column-names-flask-sqlalcamy/12866/3 "2022-01-06T14:02:22Z")

</div>

OK thanks, the only suport chanel I can find is [sqlalchemy/community - Gitter](https://gitter.im/sqlalchemy/community), is that the best option or is there anyware else I could try.

---

<div class="post-metadata">

**Author:** ![TobiasHT](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/tobiasht/32/23304_2.png) [@TobiasHT](https://discuss.python.org/u/TobiasHT)\
**Post date:** [January 6, 2022, 2:23pm UTC](https://discuss.python.org/t/specifying-column-names-flask-sqlalcamy/12866/4 "2022-01-06T14:23:33Z")

</div>

You could try that one for now.
