SQLAlchemy Return All Distinct Column Values

后端 未结 4 2077
时光取名叫无心
时光取名叫无心 2021-02-07 10:45

I am creating a website using Flask and SQLAlchemy. This website keeps track of classes that a student has taken. I would like to find a way to search my database using SQLAlc

4条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-07 11:01

    Using the model query structure you could do this

    Class.query.with_entities(Class.title).distinct()
    

提交回复
热议问题