简体   繁体   English

oracle的sqlalchemy create_engine问题

[英]sqlalchemy create_engine issue with oracle

I am trying to connect to my Oracle DB and I can not create the engine: 我正在尝试连接到我的Oracle数据库,但无法创建引擎:

engine = create_engine('oracle://user:pass@localhost:1521/dbname')

the error I get is: 我得到的错误是:

/anaconda2/lib/python2.7/site-packages/sqlalchemy/dialects/oracle/cx_oracle.pyc in __init__(self, auto_setinputsizes, exclude_setinputsizes, auto_convert_lobs, threaded, allow_twophase, coerce_to_decimal, coerce_to_unicode, arraysize, **kwargs)
705         if hasattr(self.dbapi, 'version'):
706             self.cx_oracle_ver = tuple([int(x) for x in
707                                         self.dbapi.version.split('.')])
708         else:
709             self.cx_oracle_ver = (0, 0, 0)

ValueError: invalid literal for int() with base 10: '0b1'

My OS: RedHat 7 我的操作系统:RedHat 7

Oracle Express 11g Oracle Express 11g

Python 2.7 Anaconda Python 2.7水蟒

cx_Oracle 6.0 cx_Oracle 6.0

cx_Oracle.clientversion() = (12, 2, 0, 1, 0) cx_Oracle.clientversion()=(12,2,0,1,0)

Any Idea how this could be fixed? 任何想法如何解决?

This is a bug (or at least an incompatibility) in SQLAlchemy due to the 'b' in cx_Oracle's pre-release version 6.0b1. 由于cx_Oracle的预发行版本6.0b1中的“ b”,这是SQLAlchemy中的错误(或至少是不兼容)。 The issue has been reported here with a suggested fix that you could apply to your own install of SQLAlchemy, or you can wait for a fix to be released. 已在此处报告了问题,并提供了建议的修复程序,您可以将其应用于自己的SQLAlchemy安装,也可以等待发布此修复程序。 Alternatively, that issue will not be present if you use cx_Oracle version 5.3. 或者,如果您使用cx_Oracle版本5.3,则不会出现该问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM