You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "o-nikolas (via GitHub)" <gi...@apache.org> on 2025/05/29 18:26:35 UTC

Re: [PR] Rds Operator pass custom conn_id to superclass [airflow]

o-nikolas commented on code in PR #51196:
URL: https://github.com/apache/airflow/pull/51196#discussion_r2114516972


##########
providers/amazon/src/airflow/providers/amazon/aws/operators/rds.py:
##########
@@ -54,13 +54,13 @@ class RdsBaseOperator(AwsBaseOperator[RdsHook]):
     def __init__(
         self,
         *args,
-        aws_conn_id: str | None = "aws_conn_id",
+        aws_conn_id: str | None = "aws_default",
         region_name: str | None = None,
         **kwargs,
     ):
         self.aws_conn_id = aws_conn_id
         self.region_name = region_name
-        super().__init__(*args, **kwargs)
+        super().__init__(*args, aws_conn_id=aws_conn_id, **kwargs)

Review Comment:
   The issue arose after we moved to using the AwsBaseOperator in #48872. But now that we are using that, you don't even need to handle these two values at all, since the AwsBaseOperator will set those self values.
   
   Github won't let me leave a proper Suggestion (complains about some deleted lines), but the init can be simplified down to this:
   
   ```python
   def __init__(
           self,
           *args,
           **kwargs,
       ):
           super().__init__(*args, **kwargs)
           
           self._await_interval = 60  # seconds
   ```



##########
providers/amazon/tests/unit/amazon/aws/operators/test_rds.py:
##########
@@ -174,6 +174,18 @@ def test_hook_attribute(self):
         assert hasattr(self.op, "hook")
         assert self.op.hook.__class__.__name__ == "RdsHook"
 
+    def test_overwritten_conn_passed_to_hook(self):

Review Comment:
   These tests are good, thanks for adding them :+1: 



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org