Error connecting to python-oracledb
centeiol opened this issue · 1 comments
Hello ,
I opened a Issue at sqlalchemy regarding a connection to oracle wiyh new driver oracle+oracledb, and they tell me that this issue was related to ipython-sql.
The trhread
sqlalchemy/sqlalchemy#8676 (reply in thread)
Code
import oracledb
import pandas as pd
import sqlalchemy
%reload_ext sql
#%sql oracle+oracledb://user:pass@host-scan.domain.net:1521/?service_name=XPTO.domain.net
sqlalchemy.version
Error
init() got an unexpected keyword argument 'bind'
Connection info needed in SQLAlchemy format, example:
postgresql://username:password@hostname/dbname
or an existing connection: dict_keys([])
'2.0.0b1'
Please coul you help
Regards
Until sqlalchemy supports python-oracledb, a workaround is documented here:
https://python-oracledb.readthedocs.io/en/latest/user_guide/appendix_c.html#python-frameworks-sql-generators-and-orms.
So you can use python-oracledb like this, which is very useful for running on MacOS M1 as no Oracle instant client is required:
import sys
import oracledb
oracledb.version = "8.3.0"
sys.modules["cx_Oracle"] = oracledb
import cx_Oracle
%load_ext sql
%sql oracle+cx_oracle://scott:tiger@server.domain.com:1521/?service_name=ABC