xinbinhuang commented on a change in pull request #12677:
URL: https://github.com/apache/airflow/pull/12677#discussion_r582416950



##########
File path: airflow/providers/google/cloud/hooks/bigquery.py
##########
@@ -69,8 +69,8 @@ class BigQueryHook(GoogleBaseHook, DbApiHook):
 
     conn_name_attr = 'gcp_conn_id'
     default_conn_name = 'google_cloud_default'
-    conn_type = 'google_cloud_platform'
-    hook_name = 'Google Cloud'
+    conn_type = 'bigquery'
+    hook_name = 'BigQuery'

Review comment:
       @potiuk I want to clarify a bit about the change here. The current Goold 
Providers in the master branch is broken because it doesn't return  
`BigQueryHook` when we do `Connection.get_hook` (this is the original 
behavior). 
   
   Before these 2 PRs #12466 #12558, `Connection.get_hook` was using a static 
`conn_type` -> `HookClass` mapping to get the underlying hook. However, after 
#12558, `airflow.providers.google.common.hooks.base_google.GoogleBaseHook` was 
added after `BigQueryHook` so `BigQueryHook` will be overridden during 
providers discovery. 
https://github.com/PolideaInternal/airflow/blob/802159767baf1768d92c6047c2fdb2094ee7a2a8/airflow/providers/google/provider.yaml#L714-L720
   
   To solve this, I think we can either:
   - Fix the bug by putting  `BigQueryHook`  after `GoogleBaseHook`. This will 
give back us the old behavior.
   - Rename the `conn_type` as in this PR, which will involve some versioning 
consideration.
   
   I think we can fix the bug in this PR, and create a new issue/PR with the 
new `conn_type`. I am not familiar with the overall releasing schedule and 
planning, so please let me know which one do you prefer? @potiuk @kaxil 




----------------------------------------------------------------
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:
[email protected]


Reply via email to