Lee-W commented on code in PR #48734:
URL: https://github.com/apache/airflow/pull/48734#discussion_r2035356219


##########
providers/oracle/src/airflow/providers/oracle/hooks/oracle.py:
##########
@@ -443,3 +443,30 @@ 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 service_name:
+            raise ValueError("Cannot specify both SID and Service Name. Choose 
one.")

Review Comment:
   ```suggestion
               raise ValueError("At most one allowed for 'sid', and 'service 
name'.")
   ```



##########
providers/oracle/src/airflow/providers/oracle/hooks/oracle.py:
##########
@@ -443,3 +443,30 @@ def handler(cursor):
         )
 
         return result
+
+    def get_uri(self):

Review Comment:
   ```suggestion
       def get_uri(self) -> str:
   ```



##########
providers/oracle/src/airflow/providers/oracle/hooks/oracle.py:
##########
@@ -443,3 +443,30 @@ 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 service_name:
+            raise ValueError("Cannot specify both SID and Service Name. Choose 
one.")
+
+        if sid:
+            schema = sid
+        elif service_name:
+            schema = service_name
+        else:
+            schema = conn.schema or ""
+
+        uri = f"oracle://{login}:{password}@{host}:{port}"
+
+        if schema:
+            uri += f"/{schema}"

Review Comment:
   ```suggestion
           uri = f"oracle://{login}:{password}@{host}:{port}"
           if sid:
               uri = f"{uri}/{sid}"
           elif service_name:
               uri = f"{uri}/{service_name}"
           elif conn.schema:
               uri = f"{uri}/{conn.schema}"
   ```
   
   



##########
providers/oracle/src/airflow/providers/oracle/hooks/oracle.py:
##########
@@ -443,3 +443,30 @@ 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

Review Comment:
   let's make this `1521` a constant



-- 
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]

Reply via email to