guan404ming commented on code in PR #48734:
URL: https://github.com/apache/airflow/pull/48734#discussion_r2033176111
##########
providers/oracle/src/airflow/providers/oracle/hooks/oracle.py:
##########
@@ -443,3 +443,27 @@ def handler(cursor):
)
return result
+
+ def get_uri(self):
+ """Get the URI for the Oracle connection."""
+ conn = self.get_connection(self.oracle_conn_id)
+ login = conn.login
+ password = conn.password
+ host = conn.host
+ port = conn.port or 1521
+ service_name = conn.extra_dejson.get("service_name")
+ sid = conn.extra_dejson.get("sid")
+
+ if sid and not service_name:
+ schema = sid
+ elif service_name and not sid:
+ schema = service_name
+ else:
+ schema = conn.schema or ""
Review Comment:
I implemented this fallback mechanism because Oracle connections cannot
simultaneously use both `sid` and `service_name` parameters. Rather than
arbitrarily choosing one over the other, I opted for the fallback to
`conn.schema` when both are specified. However, I recognize this approach may
cause confusion for users.
Your suggestion to raise an explicit error in this scenario is more
straightforward and would provide clearer guidance to users. I'll update the
implementation accordingly. Thank you for reviewing the code and providing
feedback.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]