/tap-salesforce

Singer.io tap for the Salesforce API

Primary LanguagePythonGNU Affero General Public License v3.0AGPL-3.0

tap-salesforce

PyPI version CircleCI Build Status

Singer tap that extracts data from a Salesforce database and produces JSON-formatted data following the Singer spec.

Install and Run

Ensure poetry is installed on your machine.

  • This command will return the installed version of poetry if it is installed.
poetry --version
curl -sSL https://install.python-poetry.org | python3 -
PATH=~/.local/bin:$PATH

Within the tap-salesforce directory, install dependencies:

poetry install

Then run the tap:

poetry run tap-salesforce <options>

Symon Specific updates

Originally taps --discover takes a long time since it gets the schema of objects one by one, also it doesn't support getting reports.

  • Added a new config to only discover one report or one object

  • Added the ability to process reports

  • When importing an object, we ignore rows that have been deleted (and are in the recycling bin on Salesforce)

Quickstart

Install the tap

> pip install tap-salesforce

Create a Config file

Config for reading a report

{
  "client_id": "secret_client_id",
  "client_secret": "secret_client_secret",
  "refresh_token": "abc123",
  "start_date": "2017-11-02T00:00:00Z",
  "api_type": "BULK",
  "select_fields_by_default": true,
  "source_type": "report",
  "report_id": "REPORT_ID"
}

Config for reading an object

{
  "client_id": "secret_client_id",
  "client_secret": "secret_client_secret",
  "refresh_token": "abc123",
  "start_date": "2017-11-02T00:00:00Z",
  "api_type": "BULK",
  "select_fields_by_default": true,
  "source_type": "object",
  "object_name": "OBJECT_NAME"
}

The client_id and client_secret keys are your OAuth Salesforce App secrets. The refresh_token is a secret created during the OAuth flow. For more info on the Salesforce OAuth flow, visit the Salesforce documentation. Additionnaly, if the Salesforce Sandbox is to be used to run the tap, the parameter "is_sandbox": true must be passed to the config.

The start_date is used by the tap as a bound on SOQL queries when searching for records. This should be an RFC3339 formatted date-time, like "2018-01-08T00:00:00Z". For more details, see the Singer best practices for dates.

The api_type is used to switch the behavior of the tap between using Salesforce's "REST" and "BULK" APIs. When new fields are discovered in Salesforce objects, the select_fields_by_default key describes whether or not the tap will select those fields by default.

Run Discovery

To run discovery mode, execute the tap with the config file.

> tap-salesforce --config config.json --discover > properties.json

Sync Data

To sync data, select fields in the properties.json output and run the tap.

> tap-salesforce --config config.json --properties properties.json [--state state.json]

Copyright © 2017 Stitch