简体   繁体   中英

SQLAlchemy + cx_oracle and special characters

I'm attempting to connect to an oracle db with SQLAlchemmy:

import sqlalchemy

oracle_db = sqlalchemy.create_engine('oracle+cx_oracle://user:passwd@host:port/schema')
connection = oracle_db.connect()

result = connection.execute("SELECT sysdate from dual")

for row in result:
    print(row)

However I'm getting the following error on line 3:

TypeError: makedsn() takes no keyword arguments

Is there something wrong with this?

Important note (please don't ask why): the password is something among the lines of:

A(sdf)1234

Do the parenthesis cause this?

That error implies you are using an older version of cx_Oracle. Keyword parameters were added to that method in 5.1.1. The latest version is 5.2.1 which you can acquire from here:

https://pypi.python.org/pypi/cx_Oracle/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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