New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question about UnicodeDecodeError #4932
Comments
there is an encoding_errors flag that will be in 1.3.11: try out from git: https://github.com/sqlalchemy/sqlalchemy/archive/rel_1_3.zip then set encoding_errors='ignore' in create_engine() pls confirm it works thanks |
1.2 is not using SQLAlchemy's decoder, it uses cx_Oracle's, which I am beginning to suspect implicitly ignores encoding errors, even though this is configurable what cx_Oracle version are you using please |
oh also is this python 2 you are using. in python 3 there's no difference |
@zzzeek Thanks for your help, it works very well. I will list my operation here.
Try: |
are you using python 2 or 3 ? |
Python2.7.15 |
ok that makes sense then, wait for 1.3.11 |
(1) Error code:
df_result = pd.read_sql_query(sql, engine)
(2) Error message:
UnicodeDecodeError: 'utf8' codec can't decode byte 0xa0 in position 41: invalid start byte
(3) Traceback:
site-packages\pandas\io\sql.py, line 314 site-packages\pandas\io\sql.py, line 1108 site-packages\sqlalchemy\engine\result.py, line 1216 site-packages\sqlalchemy\engine\base.py, line 1475 site-packages\sqlalchemy\engine\result.py, line 1211 site-packages\sqlalchemy\engine\result.py, line 1161
(4) Error Reason:
DB encoding is iso-8859-1, nls_lang is AMERICAN_AMERICA.WE8ISO8859P1,
but db table has uninterruptedly space character(encoding is 0xa0), so utf-8 can't decode it
(5) Solution:
change sqlalchemy version to 1.2.6, it's ok
pip install SQLAlchemy==1.2.6
(6) So my question is what's the difference between version 1.2.6 and version 1.3.10, could you help me?
The text was updated successfully, but these errors were encountered: