gpt4 book ai didi

python - sql查询导致python崩溃

转载 作者:行者123 更新时间:2023-11-28 19:27:09 25 4
gpt4 key购买 nike

以下查询导致 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代码吗?您能否尝试运行相同的查询,但将“%”的值放入参数中,并将其作为参数传递给游标?

关于python - sql查询导致python崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7620783/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com