VladaZakharova commented on code in PR #67113:
URL: https://github.com/apache/airflow/pull/67113#discussion_r3442743313


##########
providers/google/src/airflow/providers/google/cloud/operators/bigquery.py:
##########
@@ -64,6 +64,15 @@
 from airflow.providers.google.common.hooks.base_google import 
PROVIDE_PROJECT_ID

Review Comment:
   Good point. The hook is also a public entry point, so it should handle the 
implicit default too.
   
   Operators:
   - warn when `use_legacy_sql` is not explicitly passed
   - then pass the resolved bool to BigQueryHook
   
   BigQueryHook:
   - warn only when it is instantiated directly without `use_legacy_sql`
   - do not warn when an operator already passed an explicit/resolved value
   
   So we avoid duplicate warnings from operators, but direct hook usage is 
still covered.
   
   In code terms, the hook should warn only in this case:
   ```
   if use_legacy_sql is _UNSET:
       value = self._get_field("use_legacy_sql", _UNSET)
       if value is _UNSET:
           warnings.warn(...)
           self.use_legacy_sql = True
       else:
           self.use_legacy_sql = value
   else:
       self.use_legacy_sql = use_legacy_sql
   
   ```
   
   



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