dstandish commented on a change in pull request #19530:
URL: https://github.com/apache/airflow/pull/19530#discussion_r747184461
##########
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:
looking more closely again:
> In most cases when defining a connection using a secrets backend, such as
via an environment variable, or using a provider's secrets backend, it is not
typical to have to put the full "extra__salesforce__security_token" name.
can you provide an example?
i am only aware of GCP and it's not like this.
> Even the connections documentation for the Salesforce provider
(https://airflow.apache.org/docs/apache-airflow-providers-salesforce/stable/connections/salesforce.html)
shows defining the connection as an environment
You are correct it appears they missed updating the example URI when they
added the UI widgets and removed `security_token` as an extra. The doc is not
correct.
--
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]