airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [airflow] ashb commented on a change in pull request #6336: [AIRFLOW-5073] Change SQLSensor to optionally treat NULL as keep poking
Date Wed, 16 Oct 2019 15:49:45 GMT
ashb commented on a change in pull request #6336: [AIRFLOW-5073] Change SQLSensor to optionally
treat NULL as keep poking
URL: https://github.com/apache/airflow/pull/6336#discussion_r335560715
 
 

 ##########
 File path: airflow/sensors/sql_sensor.py
 ##########
 @@ -103,5 +103,5 @@ def poke(self, context):
             else:
                 raise AirflowException("self.success is present, but not callable -> {}".format(self.success))
         if self.allow_null:
-            return str(first_cell) not in ('0', '')
-        return str(first_cell) not in ('0', '', 'None')
+            return not (first_cell is not None or str(first_cell) == '' or int(first_cell)
== 0)
 
 Review comment:
   I'm not a fan of double-negatives. I think this is easier to understand without them. I
think this works and carries the same meaning?
   
   ```suggestion
               return first_cell is None or first_cell != '' or first_cell != 0
   ```
   
   We don't want 

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


With regards,
Apache Git Services

Mime
View raw message