我有一个从python发出的mysql查询,如下所示:
foos: Sequence[str] = get_user_specified_strs()
# Return all the rows where `foo` is in `foos`.
# If `foos` contains the string '*', return everything.
results = await conn.query_rows(
'''
SELECT ...
WHERE
'*' IN %(foos)s
OR foo IN %(foos)s
...
''',
{'foos': foos}
)
问题是 IN ()
在mysql中无效,因此 foos
将导致查询失败。有没有一种方法可以在不需要动态组装sql字符串的情况下编写查询,以便它能够处理这种情况?i、 例如,治疗 IN ()
作为 FALSE
.
暂无答案!
目前还没有任何答案,快来回答吧!