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 2022/07/25 18:55:48 UTC

[GitHub] [airflow] potiuk commented on pull request #25293: Fix legacy Airflow SqlSensor rejecting common.sql providers

potiuk commented on PR #25293:
URL: https://github.com/apache/airflow/pull/25293#issuecomment-1194483298

   This is a very interesting and originally unforeseen effect of common.sql provider separation,
   
   It's hard to test it with unit tests, because you actually you need install Airflow 2.3 or below to test it (so the tests that I added are not actually testing what you might think they are)
   
   But I tested it manually:
   
   * I prepared new providers (common.sql and oracle) 
   * I run 2.3.3 "bare version" of airflow and installed the common.sql and oracle
   * I defined oracle connection 'test_oracle'
   
   Then I repeated what "SqlSensor" does from Airflow 2.3.3:
   
   ![image](https://user-images.githubusercontent.com/595491/180852073-9fcf2670-79c6-4084-921d-ba1b9cf0d296.png)
   
   After this change when common.sql DbApiHook is installed on Airlfow 2.4+ it inherits from BaseHook, but when installed in Airlfow 2.3, it inherits from airflow.hooks.dbapi.DbApiHook (it overrides all the legacy hook methods so this has virtually no side effect).
   
   This allows the `airflow.sensors` SqlSensor to use the new Hook (which is returned by get_hook() on 'Connection' , so the SqlSensor does not know it comes from the new provider. 
   


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