Skip to main content

aisquare-pipe-salesforce

Salesforce source and sink connectors for aisquare.pipe. Ships with the aisquare-pipe[full] extras bundle.

Install

pip install aisquare-pipe-salesforce

aisquare-pipe is pulled in transitively — you don't need to install it separately.

For development (from the addon directory):

cd connectors/salesforce
pip install -e ".[dev]"

Configuration

Two authentication flows are supported. The connector picks the right one based on which keys are present in config.

# Flow 1: Username + password + security token (quick start / sandboxes)
config = {
    "username": "you@example.com",
    "password": "your-password",
    "security_token": "XXXX",
    "domain": "login",       # optional — "test" for sandboxes, default "login"
}

# Flow 2: OAuth2 refresh-token (recommended for production)
config = {
    "client_id":     "CONNECTED_APP_CONSUMER_KEY",
    "client_secret": "CONNECTED_APP_CONSUMER_SECRET",
    "refresh_token": "REFRESH_TOKEN",
    "instance_url":  "https://your-org.my.salesforce.com",
}

Usage

Pull records (generic SOQL — any standard or custom SObject)

from aisquare.pipe import PullParams
from aisquare_pipe_salesforce import SalesforceSource

source = SalesforceSource()
params = PullParams(params={
    "object_type": "Account",                 # required
    "fields": ["Id", "Name", "Industry"],     # optional, default: Id/Name/CreatedDate/LastModifiedDate
    "where": "Industry = 'Technology'",       # optional
    "order_by": "CreatedDate DESC",           # optional
    "limit": 100,                             # optional
    "modified_after": "2024-01-01T00:00:00Z", # optional — incremental sync
})

for envelope in source.pull(config, params):
    print(envelope.metadata["salesforce_id"], envelope.data)

Need a more complex query? Pass soql directly and the connector will use it verbatim:

params = PullParams(params={
    "object_type": "Account",  # still required for metadata tagging
    "soql": "SELECT Id, Name, (SELECT Id FROM Contacts) FROM Account LIMIT 10",
})

Push records (insert / update / upsert)

from aisquare.pipe import DataEnvelope, PushParams
from aisquare_pipe_salesforce import SalesforceSink

sink = SalesforceSink()

# Insert (no salesforce_id in metadata)
envelope = DataEnvelope(
    content_type="application/json",
    data={"Name": "Acme Corp", "Industry": "Technology"},
    source_id="my-app",
    metadata={"object_type": "Account"},
)
result = sink.push(envelope, config)
print(f"Created Account: {result.ref}")

# Update (salesforce_id in metadata → inferred as update)
envelope = DataEnvelope(
    content_type="application/json",
    data={"Industry": "Healthcare"},
    source_id="my-app",
    metadata={"object_type": "Account", "salesforce_id": "0011x0000XXXXXX"},
)
sink.push(envelope, config)

# Upsert by external id
envelope = DataEnvelope(
    content_type="application/json",
    data={"Name": "Acme Corp", "Industry": "Tech"},
    source_id="my-app",
    metadata={"object_type": "Account", "external_id_field": "External_Id__c"},
)
sink.push(envelope, config, PushParams(params={"external_id_value": "ext-123"}))

Pipeline (Salesforce → local)

from aisquare.pipe import Pipeline, PullParams

result = Pipeline(source=SalesforceSource(), sink=LocalSink()).run(
    {
        "salesforce-source": config,
        "local-sink": {"output_dir": "./accounts"},
    },
    pull_params=PullParams(params={"object_type": "Account", "limit": 50}),
)

Features

  • Generic SObject support — Account, Contact, Lead, Opportunity, custom objects (Foo__c), all via one connector
  • Dual auth — username/password+token (dev) and OAuth2 refresh-token (production)
  • Incremental sync — modified_after param appends LastModifiedDate > <ts> to the SOQL
  • SOQL escape hatch — pass soql verbatim for joins, sub-queries, aggregates
  • Insert / update / upsert dispatch — inferred from metadata, or set explicitly via params["operation"]
  • Rate-limit-aware — exponential backoff on REQUEST_LIMIT_EXCEEDED / HTTP 503

Notes

  • For very large pulls, set a reasonable limit and use modified_after for incremental syncs to avoid hitting per-call governor limits.
  • OAuth2 access tokens are exchanged at client creation; for long-running pulls that span the access-token TTL, re-create the source.
  • Salesforce attributes keys (the SDK's metadata noise) are stripped from each record before yielding.

Metadata

Release files for aisquare-pipe-salesforce 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aisquare-pipe-salesforce 0.1.0
File Size Uploaded Provenance Actions
aisquare_pipe_salesforce-0.1.0.tar.gz 13.3 kB With provenance Details for aisquare_pipe_salesforce-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aisquare-pipe-salesforce 0.1.0
File Interpreter ABI Platform Actions
aisquare_pipe_salesforce-0.1.0-py3-none-any.whl Python 3 none any Details for aisquare_pipe_salesforce-0.1.0-py3-none-any.whl

Total release size: 23.5 kB

Release files / aisquare_pipe_salesforce-0.1.0.tar.gz

Download URL aisquare_pipe_salesforce-0.1.0.tar.gz
Size 13.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c9a1c64e8d6c1172a8936bbeef164854a9cfda589f44b9d26c235fe9076275ad
BLAKE2b-256 checksum
How to use checksums
dd24384cd068ae559cf66e70161897f89588806de3948482da74562da24d6103
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 26, 2026.

Transparency log

Release files / aisquare_pipe_salesforce-0.1.0-py3-none-any.whl

Download URL aisquare_pipe_salesforce-0.1.0-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
157c25cfb03ad00dea6a65465d092ce3f5926fe817be1d71848c8ccfc1ad0142
BLAKE2b-256 checksum
How to use checksums
5342eb84bdeeb7eb8cab344313904150cc63a4957b91abf77f5800fa6f16a8c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 26, 2026.

Transparency log

Security for aisquare-pipe-salesforce 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for aisquare_pipe_salesforce-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page