dstandish commented on a change in pull request #19530:
URL: https://github.com/apache/airflow/pull/19530#discussion_r747182488
##########
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:
also, looking closer at your comment, i'm not opposed to the part of
this PR that makes all of the extras optional from secrets backend -- that part
we should 100% do. The part that i think would be inconsistent with past
practice is to allow two different keywords for the exact same parameter.
So to use your example, what we I think we should be able to do when this pr
is merged is this:
```
AIRFLOW_CONN_SALESFORCE_DEFAULT='http://your_username:your_password@https%3A%2F%2Fyour_host.lightning.force.com?extra__salesforce__security_token=your_token'
```
so you only have to specify the extra you need, _but_ you must use the same
keyword as that generated by the UI.
--
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]