RosterIn commented on a change in pull request #7357: [AIRFLOW-6273] Fixes 
Databricks Connection when using Token
URL: https://github.com/apache/airflow/pull/7357#discussion_r374744638
 
 

 ##########
 File path: airflow/providers/databricks/hooks/databricks.py
 ##########
 @@ -147,13 +148,32 @@ def _do_api_call(self, endpoint_info, json):
         """
         method, endpoint = endpoint_info
 
-        if 'token' in self.databricks_conn.extra_dejson:
-            self.log.info('Using token auth. ')
+        # Note: host/auth logic made more complicated to maintain
+        # backward compatibility with this commit:
+        # https://github.com/apache/airflow/pull/5635
+        if self.databricks_conn.password[0:4] == "dapi":
+            self.log.info('Using token auth.')
+            auth = _TokenAuth(self.databricks_conn.password)
+        # DEPRECATED: Will be removed in a future release
+        elif 'token' in self.databricks_conn.extra_dejson:
+            warnings.warn(
+                "Found token in extras. This will be deprecated in a future 
release. Use password field instead.",
 
 Review comment:
   Why not adding a new field to the connection called token?
   This way when adding the connection users will add the token in it's own 
field rather than the extra. Asking them to put token in password isn't 
explicit. Probably most won't do it and will have to fix once warning is raised.

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


With regards,
Apache Git Services

Reply via email to