SalesforceReportSrc
class SalesforceReportSrc(
reports: ReportsSpec,
column_name_strategy: Literal['columnName', 'label'] = 'columnName',
find_report_by: Literal['id', 'name'] | None = None,
filter: FilterSpec | None = None,
filter_logic: str | None = None,
last_modified_column: str | None = None,
initial_last_modified: datetime | None = None,
src_cfg: SrcCfgSpec | None = None,
)
Bases: Src
Categories: source
Salesforce report source for @publisher -- Tabular reports
only.
Every table this source publishes automatically carries two
metadata columns: @td.salesforce.report_id, the resolved report
id that produced the row (even when reports named the report by
name), and @td.salesforce.last_modified, the source's
initial_last_modified cutoff (empty when unset). Setting the
src_cfg key tabsdata.src_metadata.drop to True leaves them
off.
Examples
Publish a Tabular report by id, filtered server-side before download:
@publisher(
source=SalesforceReportSrc(
reports=["00O000000000001"],
filter=[("Type", "equals", "Customer")],
),
output_tables=["customers"],
)
def ingest(customers: TableFrameSpec) -> TableFrameSpec:
return customers
Parameters
reportsReportsSpec (list[str])Report ids or names, one output slot per entry (non-empty list).
column_name_strategyLiteral['columnName', 'label']"columnName" (default, API names) or
"label" (display names).
find_report_byLiteral['id', 'name'] | NoneLookup strategy for a reports entry that
could be either a report id (15- or 18-char alphanumeric)
or a report name -- "id" forces id lookup, "name"
forces name lookup. Leave unset to auto-detect; set it to
break the tie when both forms resolve.
filterFilterSpec | None (list[tuple[str, Literal['equals', 'notEqual', 'lessThan', 'greaterThan', 'lessOrEqual', 'greaterOrEqual', 'contains', 'notContain', 'startsWith', 'includes', 'excludes', 'within', 'between'], str]] | None)Optional list of (column, operator, value) triples
applied on the server before download. operator is one
of equals, notEqual, lessThan, greaterThan,
lessOrEqual, greaterOrEqual, contains,
notContain, startsWith, includes, excludes,
within or between.
filter_logicstr | NoneOptional boolean expression over the filter
entries, e.g. "(1 AND 2) OR 3".
last_modified_columnstr | NoneOptional column for incremental
last-modified filtering; requires initial_last_modified
(and vice versa).
src_cfgSrcCfgSpec | None (Mapping[Literal['salesforce.logging_level', 'tabsdata.src_metadata.drop'], Any] | None)Optional connector config over the keys
salesforce.logging_level and
tabsdata.src_metadata.drop.
Methods
validatedef validate()
Validate the last-modified column and cutoff are set together.
Called by the framework; raises SalesforceValidateException.