我试图在Hadoop上的Cloudera Impala的python impyla查询中转义字符,但似乎没有任何工作..模板语法不会转义(对于数据库API不常见..)
cursor.execute('SELECT * from table where col1 = %s', tuple(["John's unescaped string"]))
产生错误。
甚至
cursor.execute('SELECT * from table where col1 = %s', tuple([json.dumps("John's unescaped string")]))
不起作用,有没有人知道如何为此提供解决方案?是否有更好的方法或更全功能的Python Impala库?
答案 0 :(得分:0)
您可以对r
占位符
?
然而,impyla仍然存在引用转义和unicode的其他问题,我还没有完全弄明白。