来自 Oracle 的pd.read_sql返回解码错误



我正在尝试使用PANDAS从ORACLE读取数据:

pd.read_sql(sql, myORACLEinfo)

其中 SQL 是选择语句

我不拥有 ORACLE 表,也无法更改表日期。

pd.read_sql返回此错误:

 refresh 'charmap' codec can't decode byte 0x81 in position 1101:
 character maps to <undefined>

有没有办法转义/忽略此错误。
我尝试添加:encoding='iso-8859-1'炼金术create_engine设置,

假设 ORACLE 的默认编码是 iso-8859-1 ,但这没有帮助

这是一个编码问题。对于python 2.7cx_Oracle 7.3.0:当您连接到Oracle DB时,您需要指定编码类型,如下所示:

x_Oracle.connect(username, password, connection_string, encoding="UTF-8")

也可以指定nencoding parameter = "UTF-8"

干杯!

最新更新