问题
In my sqlobject implementation I have the following line:
members = Member.select("CONCAT_WS(' ', member.first_name, member.last_name, member.personal_code_number, member.mail) like " + Member.sqlrepr('%' + query + '%'))
I want to convert that to using sqlalchemy but haven't found a way to do that.
回答1:
members = session.query(Member).filter(
func.CONCAT_WS(' ', Member.first_name, Member.last_name, Member.personal_code_number, Member.mail)
.like('%' + query + '%')
)
来源:https://stackoverflow.com/questions/20914464/concat-ws-in-sqlalchemy