potiuk commented on issue #36948:
URL: https://github.com/apache/airflow/issues/36948#issuecomment-1910279616

   > My proposed fix it is just for avoid provide logger_name implicitly even 
if it not defined. If we would like to check version than we need to make fixes 
in all providers.
   
   I understand - but the thing is that our Hooks are mostly used internally by 
Operators and both Hooks and opertors are relased in providers, so there is a 
risk that someone will add an Operator that will initialize Hook with 
logger_name (which might be then exposed by or even hard-coded in the operator) 
. By implementing a protection against it in Hook, we allow such change to 
happen without waiting for min-airflow >= 2.8.0.
   
   In other words - our code in Airflow that uses hooks - will not be able to 
use the `logger_name` in any way if we do it the way you proposed. We will not 
be able to release an Operator which will adds the option of specifying it - 
you will only be able to specify the `logger_name" directly in the DAG code 
were Hooks are used directly or when users would like to develop custom 
operators and they are **100% sure** the operator will be used in airflow 
2.8.0+. Maybe that's what we want to do, but I think it is limiting. So for 
example if someone develops custom provider, that might use (say) common.sql  
DBApiHook. They will have to add "apache-airflow>=2.8.0" if their Operator will 
pass "logger_name" to the hook.
   
   The first proposal will work in all cases. It will only propagate 
logger_name to Base Hook in Airflow 2.8.0 - and will set no limitations on the 
users of the Hook to **know** they are run in Airflow 2.8.0 environment. You 
might just write custom operator (or we can implement it in our operators) to 
specify logger_name and it will work, regardless of what "airflow version" the 
operator is installed at. So in the above example - if somoene would like to 
create their own provider and use "DBApiHook" they will be able to create an 
operator that will use it it and pass "logger_name" = "mylogger" to it (and 
they will not have to add `apache-airlfow>= 2.8.0` in their 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to