Regular expressions in SQLalchemy queries?

前端 未结 3 1488
旧时难觅i
旧时难觅i 2020-12-29 20:56

Is it possible to use a regex in a way similar to session.query(MyObject).filter_by(REGEX)?

If not, how can I use sqlAlchemy to retrieve records that ha

3条回答
  •  说谎
    说谎 (楼主)
    2020-12-29 21:59

    For the record, you can do essentially the same syntax as Paulo Scardine's answer in SQLAlchemy too;

    session.query(Object).filter(Object.column.like('something%'))
    

提交回复
热议问题