如何将 Airflow 连接到 oracle 数据库

2021-12-30 00:00:00 airflow database oracle11g oracle

我正在尝试使用 Airflow 创建与 oracle 数据库实例 (oracle:thin) 的连接.

根据他们的

建立连接后,它会为我尝试执行的每个查询提供保存错误代码 (ORA-12514).似乎 oracle 不允许气流连接:

ORA-12514:TNS:listener 当前不知道连接描述符中请求的服务

之前是否有人遇到过同样的问题.我的意思是,对于像这样的大平台,连接到数据库应该不是问题.或者我可能做错了什么.谢谢

版本:Airflow v1.7.0,Oracle11g

我使用的主机名与我在 Oracle SQLDeveloper 客户端中使用的主机名相同:

解决方案

在深入研究源代码后,这就是它最终为我工作的方式:

连接类型:Oracle

主机:example.com

架构:用户名

登录:用户名

端口:端口号

额外:{"sid": "my sid", "dsn": "example.com"}

I am trying to create a connection to an oracle db instance (oracle:thin) using Airflow.

According to their documentation I entered my hostname followed by port number and SID:

Host: example.com:1524/sid

filled other fields as:

Conn Type: Oracle

Schema: username ( documentation says: use your username for schema )

Login: username

Password: * * *

After connection is setup, it gives the save error code for every query that I tried to execute (ORA-12514). It seems like oracle doesn't let airflow to connect:

ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

Has someone experienced the same problem before. I mean connecting to a database shouldn't be a problem for a big platform like this. Or I am probably doing something wrong. Thanks

Version: Airflow v1.7.0, Oracle11g

EDIT:

I am using the same hostname which I use in Oracle SQLDeveloper client:

解决方案

After digging into the source code, this is what finally how it worked for me:

Conn Type: Oracle

Host: example.com

schema: username

login: username

port: port number

extra: {"sid": "my sid", "dsn": "example.com"}

相关文章