开发者

SQL Alchemy and CX_Oracle Reflection Issue

I am having problems reflecting tables in Oracle using cx_Oracle version 5.1 (autoload=True). Everything works fine under cx开发者_如何学Go_Oracle version 5.0.4. Here's the error I get:

DatabaseError: (DatabaseError) ORA-01460: unimplemented or unreasonable conversion requested 

Somehow, the query sent to oracle is not substituting the tablename and schema correctly. Has anybody seen anything like this and have a solution? I'd like to avoid to define columns manually for all the tables. I also want to use the latest versions if possible.


I just submitted a patch that fixes this issue for me. Support for Unicode was added to cx_Oracle and then later removed. There are a few lines in SQLAlchemy's cx_oracle.py that check the version of the cx_Oracle module. The patch updates these version checks to take into account the reverted Unicode support.

I think that it was your question that helped me get SQLAlchemy working with cx_Oracle for the first time a few weeks ago, so thanks for asking! :-D


As discussed in the thread for the patch of Alex, a solution is to set the NLS_LANG environment variable, so that cx_oracle can use the right converter. For example:

import os 
os.environ["NLS_LANG"] = ".UTF8"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜