How to Connect Airflow to oracle database
You have a problem in your connection settings, either your setting is not loading properly to the oracle hook or you are missing a python package that save/load your connection settings. You can test it by hard coding your credentials.
https://github.com/airbnb/airflow/blob/master/airflow/hooks/oracle_hook.py
conn = self.get_connection(self.oracle_conn_id)
dsn = conn.extra_dejson.get('dsn', None)
sid = conn.extra_dejson.get('sid', None)
service_name = conn.extra_dejson.get('service_name', None)
if dsn and sid and not service_name:
dsn = cx_Oracle.makedsn(dsn, conn.port, sid)
conn = cx_Oracle.connect(conn.login, conn.password, dsn=dsn)
elif dsn and service_name and not sid:
dsn = cx_Oracle.makedsn(dsn, conn.port, service_name=service_name)
conn = cx_Oracle.connect(conn.login, conn.password, dsn=dsn)
else:
conn = cx_Oracle.connect(conn.login, conn.password, conn.host)
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"}