无法将超集连接到oracle数据库

问题描述 投票:0回答:1

Error when add new database

嗨,我尝试在 ubuntu 上使用 docker 安装 superset,但是当我尝试连接我的 oracle 数据库时,出现此错误。我已经添加了 RUN pip install cx_Oracle ini Dockerfile 但仍然不起作用。

如何解决这个问题,我尝试在 Dockerfile 中添加配置安装 cx_Oracle 模块,并且我已经在 ubuntu 中安装了 cx_Oracle

oracle docker ubuntu apache-superset
1个回答
0
投票

我让 Superset 与 python-oracledb 一起使用(cx_Oracle 的替代品,请参阅发布公告)。

您需要在 Dockerfile 中运行此命令或等效命令:

python -m pip install oracledb --upgrade

然后在

superset_config.py
我添加了这个,这使得 Superset 使用 python-oracledb 代替 cx_Oracle:

import sys
import oracledb
oracledb.version = "8.3.0"
sys.modules["cx_Oracle"] = oracledb
import cx_Oracle

为了使 SQLAlchemy 连接字符串变得简单,我使用数据库连接描述符创建了一个

tnsnames.ora
文件
$HOME/config/tnsnames.ora

echo 'cjdb = (description=(address=(protocol=tcps)(port=1521)(host=xxx.oraclecloud.com))(connect_data=(service_name=xxxx.adb.oraclecloud.com))(security=(ssl_server_dn_match=yes)))' > $HOME/config/tnsnames.ora

并设置:

export TNS_ADMIN=$HOME/config

我启动了我的超级集服务器:

superset run -h 0.0.0.0 -p 8088 --with-threads --reload --debugger

然后在 Superset Web 控制台上,我在右上角菜单中选择“+” -> 数据 -> 连接数据库。在 SUPPORTED DATABASES 字段中,我选择了“Oracle”并添加了 SQLAlchemy URI,例如:

oracle://cj:mysecret password@cjdb

© www.soinside.com 2019 - 2024. All rights reserved.