Skip to content

How to use the "IN" clause using the select statement #1475

Answered by mgurg
Praveenstein asked this question in Questions
Discussion options

You must be logged in to vote

Hi, try this way:

        db_setting = session.exec(select(Settings).where(Settings.id.in_([1,2,3]))).all()

UPD YuriiMotov:
Use col as @hrehfeld showed to get atocompletions.

        db_setting = session.exec(select(Settings).where(col(Settings.id).in_([1,2,3]))).all()

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by YuriiMotov
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
4 participants
Converted from issue

This discussion was converted from issue #353 on August 11, 2025 03:44.