Skip to content

How can we use with_entities while using databases library? #394

Answered by aminalaee
MilanRgm asked this question in Q&A
Discussion options

You must be logged in to vote

This should work:

query = User.select().with_only_columns([User.c.email, User.c.id])

results = await database.fetch_all(query=query)

https://docs.sqlalchemy.org/en/14/core/selectable.html#sqlalchemy.sql.expression.Select.with_only_columns

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by aminalaee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants