以下查询导致python崩溃(“python.exe遇到问题…”
进程以1073741819的退出代码终止。
问题是:

create temp table if not exists MM_lookup2 as
select lower(Album) || lower(SongTitle) as concat, ID
from MM.songs
where artist like '%;%' collate nocase

如果我从“like”改为=它按预期运行,例如
create temp table if not exists MM_lookup2 as
select lower(Album) || lower(SongTitle) as concat, ID
from MM.songs
where artist = '%;%' collate nocase

我运行的是python v2.7.2,里面有任何版本的sqlite。
问题查询在python之外运行时没有问题。

最佳答案

您没有编写正在使用的数据库系统/驱动程序。我怀疑问题出在你的SQL上。%个字符需要转义。可能DB驱动程序模块试图将%和%解释为格式字符,并且它不能将不存在的参数值转换为数据库后端可接受的格式。
你能给我们具体的Python代码吗?请尝试运行相同的查询,但将“%,%”的值放入参数中,并将其作为参数传递给游标,好吗?

08-17 10:08
查看更多