ashb commented on a change in pull request #12466:
URL: https://github.com/apache/airflow/pull/12466#discussion_r528730331



##########
File path: airflow/providers/apache/hive/hooks/hive.py
##########
@@ -78,9 +78,13 @@ class HiveCliHook(BaseHook):
     :type  mapred_job_name: str
     """
 
+    conn_name_attr = 'hive_cli_conn_id'

Review comment:
       What was your thinking for `conn_name_attr` instead of `CONN_NAME_ATTR`?
   
   (My default would be to use the latter, as it's a common signifier that it's 
a constant.)

##########
File path: airflow/providers/apache/hive/hooks/hive.py
##########
@@ -78,9 +78,13 @@ class HiveCliHook(BaseHook):
     :type  mapred_job_name: str
     """
 
+    conn_name_attr = 'hive_cli_conn_id'
+    default_conn_name = 'hive_cli_default'
+    conn_type = 'hive_cli'
+
     def __init__(
         self,
-        hive_cli_conn_id: str = "hive_cli_default",
+        hive_cli_conn_id: str = default_conn_name,

Review comment:
       We could, if we wanted, use `inspect.signature` to get the default value 
for the hook:
   
   ```ipython
   In [3]: from airflow.providers.apache.hive.hooks.hive import HiveCliHook     
                                                                                
                                                                                
                                                               
   
   In [4]: import inspect                                                       
                                                                                
                                                                                
                                                               
   
   In [5]: 
inspect.signature(HiveCliHook).parameters['hive_cli_conn_id'].default           
                                                                                
                                                                                
                                                    
   Out[5]: 'hive_cli_default'
   ```
   
   Not needed, and might be overkill, but is just one less thing to need in the 
"interface"




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