查询引擎使用了presto,在sql中使用了模糊查询。 engine = create_engine(presto_url,encoding='utf-8') sql_exe ="""select id,title,tags from source.base.table where tags like '%呵呵%' """
df = pd.read_sql_query(sql_exe,engine)
一直报错:unsupported format character
解决方案
1 sql_exe ="""select id,title,tags from source.base.table where tags like '%%呵呵%%' """
2 sql_exe ="""select id,title,tags from source.base.table where tags like %s """
df = pd.read_sql_query(sql_exe,engine,params=("%呵呵%",))

本文介绍在使用Presto查询引擎时,如何正确进行模糊查询。通过调整SQL语句中的like子句,解决了因字符匹配错误导致的问题,确保了查询结果的准确性。
1008

被折叠的 条评论
为什么被折叠?



