You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/11/10 22:08:41 UTC

[GitHub] [airflow] dstandish commented on a change in pull request #19530: Do not require all extras for SalesforceHook and allow non-prefixed extras

dstandish commented on a change in pull request #19530:
URL: https://github.com/apache/airflow/pull/19530#discussion_r747023851



##########
File path: airflow/providers/salesforce/hooks/salesforce.py
##########
@@ -131,22 +131,39 @@ def get_conn(self) -> api.Salesforce:
         if not self.conn:

Review comment:
       using a cached_property instead is a common pattern in airflow and IMHO cleaner

##########
File path: airflow/providers/salesforce/hooks/salesforce.py
##########
@@ -131,22 +131,39 @@ def get_conn(self) -> api.Salesforce:
         if not self.conn:
             connection = self.get_connection(self.conn_id)
             extras = connection.extra_dejson
+            # all extras below (besides the version one) are explicitly defaulted to None
+            # because simple-salesforce has a built-in authentication-choosing method that
+            # relies on which arguments are None and without "or None" setting this connection
+            # in the UI will result in the blank extras being empty strings instead of None,
+            # which would break the connection if "get" was used on its own.
             self.conn = Salesforce(
                 username=connection.login,
                 password=connection.password,
-                security_token=extras["extra__salesforce__security_token"] or None,
-                domain=extras["extra__salesforce__domain"] or None,
+                security_token=extras.get('security_token')

Review comment:
       question... why are we [re?]introducing the `security_token` alongside the `extra__salesforce__`-formatted one?
   
   is it for backward compat?  i'd assume if these were  renamed then it was done in a major and we need not worry about backward compat?




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org