You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/04/13 04:51:46 UTC

[GitHub] [airflow] xinbinhuang commented on a change in pull request #15233: Update sqs.py

xinbinhuang commented on a change in pull request #15233:
URL: https://github.com/apache/airflow/pull/15233#discussion_r612128944



##########
File path: airflow/providers/amazon/aws/sensors/sqs.py
##########
@@ -50,13 +52,15 @@ def __init__(
         aws_conn_id: str = 'aws_default',
         max_messages: int = 5,
         wait_time_seconds: int = 1,
+        message_attribute_names: list = ['.*']

Review comment:
       Let's push it under the constructor
   ```suggestion
           message_attribute_names: Optional[List[str]] = None
   ```
   
   And then within the constructor
   ```python
   self.message_attribute_names = ['.*'] if message_attribute_names is None else message_attribute_names 
   ```
   
   The reason being python has gotcha around [mutable default arguments](https://docs.python-guide.org/writing/gotchas/#mutable-default-arguments)
   
   
   

##########
File path: airflow/providers/amazon/aws/sensors/sqs.py
##########
@@ -38,6 +38,8 @@ class SQSSensor(BaseSensorOperator):
     :type max_messages: int
     :param wait_time_seconds: The time in seconds to wait for receiving messages (default: 1 second)
     :type wait_time_seconds: int
+    :param message_attribute_names: The message attribute names to filter receiving messages (default: All Messages)
+    :type wait_time_seconds: list

Review comment:
       ```suggestion
       :type message_attribute_names: list
   ```




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

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