Skip to content

Salesforce Provider: connection params in extra require "extra__salesforce__" prefix #27187

@park-peter

Description

@park-peter

Apache Airflow Provider(s)

salesforce

Versions of Apache Airflow Providers

apache-airflow-providers-amazon==5.1.0
apache-airflow-providers-apache-hive==4.0.0
apache-airflow-providers-apache-livy==3.1.0
apache-airflow-providers-celery==3.0.0
apache-airflow-providers-cncf-kubernetes==4.3.0
apache-airflow-providers-common-sql==1.2.0
apache-airflow-providers-databricks==3.2.0
apache-airflow-providers-dbt-cloud==2.1.0
apache-airflow-providers-elasticsearch==4.2.0
apache-airflow-providers-ftp==3.1.0
apache-airflow-providers-google==8.3.0
apache-airflow-providers-http==4.0.0
apache-airflow-providers-imap==3.0.0
apache-airflow-providers-microsoft-azure==4.2.0
apache-airflow-providers-postgres==5.2.1
apache-airflow-providers-redis==3.0.0
apache-airflow-providers-salesforce==5.1.0
apache-airflow-providers-sftp==4.0.0
apache-airflow-providers-slack==5.1.0
apache-airflow-providers-snowflake==3.2.0
apache-airflow-providers-sqlite==3.2.1
apache-airflow-providers-ssh==3.1.0

Apache Airflow version

2.4.1

Operating System

bullseye 11

Deployment

Astronomer

Deployment details

No response

What happened

When adding salesforce connection in URI or JSON format, the documentation states that the extras should be passed as parameters, i.e. security_token or instance_url, into this format: http://your_username:your_password@https%3A%2F%2Fyour_host.lightning.force.com?security_token=your_token.

However, the provider is actually saving the connection with extras with extra__salesforce__ prefix, i.e. salesforce://your_username:your_password@/?extra__salesforce__security_token=your_token. When saving it as a JSON format, we have to format the connection as:

"extra": {
  "extra__salesforce__security_token": "your_token",
  "extra__salesforce__instance_url": "your_host",
}

This is not consistent with the documentation and the way other providers save their connection. It is causing a lot of confusion when saving the connection info in URI/JSON format, especially when trying to save this info on an alternative secrets backend.

What you think should happen instead

The URI should not have extra params with the extra__salesforce__ prefix.

How to reproduce

Save Salesforce connection from Airflow UI and print out the URI using

conn = BaseHook.get_connection(conn_id=conn_id)
print(conn.get_uri())

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions