potiuk commented on PR #41047: URL: https://github.com/apache/airflow/pull/41047#issuecomment-2253142027
You can't do it in BaseOperator. The compatibility code shoudl be implemented in those operators that gets incompatible (because eventually you will have - say - 2.7.1 BaseSensor and the new - say Http - Operator. We recently added `common.compat` provider for that purpose - so such common code raising warnings could be placed there and called from each operator. In this case that code should raise the warning on 2.10 and not raise warning on <2.10. This way we avoid logic copy-pasting between providers. Then each of those provider will have to depend on the next version of the common.compat, in order to make sure that code is available. For example we have get_hook_lineage_collector added in 2.10 : https://github.com/apache/airflow/blob/main/airflow/providers/common/compat/lineage/hook.py#L20 and a number of providers using it import it (until they reach 2.10 minimum level) from there https://github.com/apache/airflow/blob/1ff3717f35e98336dc67fb44ad4d7cc8ceeacf2b/airflow/providers/amazon/aws/hooks/s3.py#L44 And the aws provider has a dependency on common.compat: 1.1.0 https://github.com/apache/airflow/blob/1ff3717f35e98336dc67fb44ad4d7cc8ceeacf2b/airflow/providers/amazon/provider.yaml#L92 The 1.1.0 compat has not been released yet https://airflow.apache.org/docs/apache-airflow-providers-common-compat/stable/index.html - so you can still add the code to common.compat and set all the providers to depend on 1.1.0 of common compat. -- 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]
