Connectors
CRM connector primitives. Pull/push records from commercial CRMs
(Salesforce, HubSpot, Zoho, Microsoft Dynamics 365) through a unified
ConnectorProtocol.
CRM connector primitives — lazy-loaded.
Pull/push records from commercial CRMs (Salesforce, HubSpot, Zoho,
Microsoft Dynamics 365) through a unified ConnectorProtocol.
CRM data flows into the analytics pipeline — normalize via
identifiers/, enrich via geo/, visualize via reporting/.
See docs/epics/CRM_INTEGRATIONS_EPIC.md for the full epic.
Protocol
Connector protocol and shared types for CRM integrations.
Defines the contract that all CRM connectors satisfy, plus supporting
types for bulk operations and error handling. Follows the Gazetteer
Protocol pattern (geo.gazetteers.base): narrow, runtime-checkable,
intentionally minimal.
Connectors are primitives — pull/push records. Transformation lives
in identifiers/, geo/, reporting/. No sync scheduling,
no CDC, no conflict resolution beyond dedup.
- class siege_utilities.connectors._protocol.ConnectorProtocol[source]
Bases:
ProtocolCRM connector contract.
The protocol is intentionally narrow — eight methods. Backends layer OAuth token refresh, rate-limit backoff, pagination, and other plumbing internally; callers just see this surface.
Each connector may expose vendor-specific methods beyond the protocol (e.g.,
SalesforceConnector.soql()). The protocol captures the shared shape that reporting, dedup, and enrichment pipelines depend on.- authenticate()[source]
Establish an authenticated session.
- Raises:
ConnectorAuthError – credentials invalid or auth flow failed.
- Return type:
None
- get_objects(object_type, *, fields=None, filters=None, limit=None)[source]
Fetch records of object_type as a DataFrame.
- Parameters:
object_type (str) – CRM object name (
"Contact","Opportunity").fields (list[str] | None) – Columns to return.
Nonefor a sensible default set.filters (dict[str, Any] | None) – Key-value filter criteria (interpretation is connector-specific).
limit (int | None) – Maximum records to return.
Nonefor all.
- Raises:
ConnectorNotFoundError – object_type does not exist.
ConnectorAuthError – session expired or insufficient permissions.
ConnectorRateLimitError – API rate limit hit.
- Return type:
- update_record(object_type, record_id, data)[source]
Update a single record; return
Trueon success.Raises on failure — never returns
Falsesilently (SU-1).
- upsert_records(object_type, records, match_field)[source]
Bulk create-or-update from a DataFrame.
- Parameters:
object_type (str) – Target CRM object.
records (pandas.DataFrame) – DataFrame whose columns map to CRM fields.
match_field (str) – Column used to match existing records (e.g.,
"email"for contacts).
- Returns:
UpsertResultwith per-record outcome.- Raises:
ConnectorAuthError – session expired.
ConnectorRateLimitError – API rate limit hit.
- Return type:
- __init__(*args, **kwargs)
- class siege_utilities.connectors._protocol.UpsertResult[source]
Bases:
objectOutcome of a bulk upsert operation.
Never silent —
failure_count == 0is the only success signal. Callers must checkerrorswhenfailure_count > 0(SU-1).- errors: list[UpsertError]
- class siege_utilities.connectors._protocol.UpsertError[source]
Bases:
objectOne failed record in a bulk upsert.
- exception siege_utilities.connectors._protocol.ConnectorError[source]
Bases:
ExceptionBase for all connector errors.
- exception siege_utilities.connectors._protocol.ConnectorAuthError[source]
Bases:
ConnectorErrorAuthentication or authorization failure.
- exception siege_utilities.connectors._protocol.ConnectorRateLimitError[source]
Bases:
ConnectorErrorAPI rate limit exceeded.
- exception siege_utilities.connectors._protocol.ConnectorNotFoundError[source]
Bases:
ConnectorErrorRequested object type or record not found.