sqlalchemy fails to connect but cx_oracle succeeds

笑着哭i 提交于 2019-12-06 21:53:28

Per the doc, the format of your Oracle connection string with SQLAlchemy should be oracle+cx_oracle://user:pass@host:port/dbname[?key=value&key=value...]. But based on your former connection string, the db value might actually be the TNS service name, so in this case, you want to use

engine = sqlalchemy.create_engine('oracle+cx_oracle://' + user + ':' + pw + '@' + host + ':' + port + '/?service_name=' + db)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!