Open sae13 opened 10 months ago
use : pip install cx_oracle
use : pip install cx_oracle
I dont want. I want use python-oracle db which does not need oracle client
@sae13 Did you find a solution to use the oracledb library?
Bump - cx_oracle will not get any new major releases, as development continues under the python-oracledb package. Support for this would be nice, in order to not be stuck with an old version.
Just made a similar comment on this issue: https://github.com/apache/superset/issues/20371
Perhaps we should close one or the other as a duplicate :)
In any case, has anyone tested python-oracledb to see if it works? It sounded like cx_oracle
was working for some, and python-oracledb
is supposed to be a drop-in replacement.
I tried it recently on my work computer (cannot look up the exact error right now), and it did not work. Oracle did not show up as an option and using "Other" and using the connection string as specified in the python-oracledb docs did not work.
oracledb support was added in SQLAlchemy 2.0. Superset is using SQLAlchemy 1.4
With SQLAlchemy 1.4 you can use python-oracledb in place of cx_Oracle by inserting this code snippet before anything loads cx_Oracle, e.g. add it to superset_config.py
:
import sys
import oracledb
oracledb.version = "8.3.0"
sys.modules["cx_Oracle"] = oracledb
import cx_Oracle
See the python-oracledb doc: https://python-oracledb.readthedocs.io/en/latest/user_guide/appendix_c.html#python-frameworks-sql-generators-and-orms and https://levelup.gitconnected.com/using-python-oracledb-1-0-with-sqlalchemy-pandas-django-and-flask-5d84e910cb19
Don't forget to install the new driver:
python -m pip install oracledb
With this in place, the Superset console SUPPORTED DATABASES will show 'Oracle'. The SQLAlchemy URI uses the SQLAlchemy 1.4 syntax, eg. oracle://cj:mysecret password@cjdb
I posted more detail in Steps to use Apache Superset and Oracle Database.
hey hi sqlalchemy supports python-oracledb which does not need oracle client oackage https://docs.sqlalchemy.org/en/20/dialects/oracle.html#module-sqlalchemy.dialects.oracle.oracledb
https://pypi.org/project/oracledb/
its connection string is like
'oracle+oracledb://user:password@host:port/pdb'
I installed it with this dockerfile
but im getting![image](https://github.com/apache/superset/assets/17175994/742de882-d856-4200-83f9-9084283f0329)
ERROR: Could not load database driver: OracleEngineSpec
for now im using cx_Oracle with this docker file but I want to know how I can use python-oracledb