Prerequisites
Before proceeding, ensure the following prerequisites are met:- Install MindsDB locally via Docker or Docker Desktop.
- To connect Salesforce to MindsDB, install the required dependencies following this instruction.
Connection
Establish a connection to Salesforce from MindsDB by executing the following SQL command and providing its handler name as an engine.- username: The username for the Salesforce account.
- password: The password for the Salesforce account.
- client_id: The client ID (consumer key) from a connected app in Salesforce.
- client_secret: The client secret (consumer secret) from a connected app in Salesforce.
- is_sandbox: The setting to indicate whether to connect to a Salesforce sandbox environment (- true) or production environment (- false). This parameter defaults to- false.
To create a connected app in Salesforce and obtain the client ID and client secret, follow the steps given below:
- Log in to your Salesforce account.
- Go to Settings>Open Advanced Setup>Apps>App Manager.
- Click New Connected App, selectCreate a Connected Appand clickContinue.
- Fill in the required details, i.e., Connected App Name,API NameandContact Phone.
- Select the Enable OAuth Settingscheckbox, set theCallback URLto wherever MindsDB is deployed followed by/verify-auth(e.g.,http://localhost:47334/verify-auth), and choose the following OAuth scopes:
- Manage user data via APIs (api)
- Perform requests at any time (refresh_token, offline_access)
- Click Saveand thenContinue.
- Click on Manage Consumer DetailsunderAPI (Enable OAuth Settings), and copy the Consumer Key (client ID) and Consumer Secret (client secret).
- Click on Back to Manage Connected Appsand thenManage.
- Click Edit Policies.
- Under OAuth Policies, configure thePermitted UsersandIP Relaxationsettings according to your security policies. For example, to enable all users to access the app without enforcing any IP restrictions, selectAll users may self-authorizeandRelax IP restrictionsrespectively. Leave theRefresh Token Policyset toRefresh token is valid until revoked.
- Click Save.
- Go to Identity>OAuth and OpenID Connect Settings.
- Ensure that the Allow OAuth Username-Password Flowscheckbox is checked.
Usage
Retrieve data from a specified table by providing the integration and table names:The above examples utilize 
salesforce_datasource as the datasource name, which is defined in the CREATE DATABASE command.Salesforce Table Filtering
We have implemented a filtering logic to exclude tables that are generally not useful for direct business queries, which fall into the following categories:- System and Auditing Tables: We exclude tables that track field history, record sharing rules, and data change events (e.g., objects ending in History, Share, or ChangeEvent). These are important for system administration but not for typical business analysis.
- Configuration and Metadata: We remove tables that define the structure and configuration of Salesforce itself. This includes objects related to user permissions, internal rules, platform settings, and data definitions (e.g., FieldDefinition, PermissionSet, AssignmentRule).
- Feature-Specific Technical Objects: Tables that support specific backend Salesforce features are excluded. This includes objects related to:
- AI and Einstein: (AI…)
- Developer Components: (Apex…, Aura…)
- Data Privacy and Consent: (objects ending in Consent or containing Policy)
- Chatter and Collaboration Feeds: (…Feed, Collaboration…)
 
- Archived or Legacy Objects: Older objects that have been replaced by modern equivalents, such as ContentWorkspace, are also excluded to simplify the list.