SalesforceReportSource
class SalesforceReportSource(
credentials: SalesforceCredentials,
report: str | list[str],
column_name_strategy: Literal['columnName', 'label'],
find_report_by: Literal['id', 'name'] = None,
filter: tuple[str, str, str] | list[tuple[str, str, str]] = None,
filter_logic: str = None,
instance_url: str = None,
last_modified_column: str = None,
initial_last_modified: str = None,
**kwargs,
)
Bases: SourcePlugin
Categories: source
Salesforce Reports based data inputs.
Initializes the SalesforceReportSource with the report information and the credentials to access Salesforce.
Parameters
credentialsThe credentials to access Salesforce.
reportThe report or reports to execute in Salesforce. It can be a single string or a list of strings. The string must be either the report ID or the name of the report.
column_name_strategyIndicates which column attribute to use as the column name in the output data. It can be one of the following: - "columnName": The API name of the column (e.g., "ACCOUNT.NAME"). - "label": The label of the column (e.g., "Account Name").
find_report_byIndicates whether the 'report' parameter contains report IDs or report names. If not provided, it will be inferred from the value of the 'report' parameter.
filterA filter or list of filters to apply to the report. Each filter is a tuple of three strings: (field, operator, value). For example: [("CreatedDate", "greaterThan", "2023-01-01T00:00:00.000Z")]. The possible operators are: - equals - notEqual - lessThan - greaterThan - lessOrEqual - greaterOrEqual - contains - notContain - startsWith - includes - excludes - within - between Defaults to None.
filter_logicA string representing the logic to apply to the filters. For example: "(1 AND 2) OR 3". The numbers correspond to the position of the filters in the 'filter' list (starting at 1). Defaults to None.
instance_urlThe URL of the instance to which we want to connect. Only necessary when the username and password are associated to more than one instance. Defaults to None.
last_modified_columnThe name of the column to use for incremental loading based on the last modified date. If provided, the report must contain this column. Defaults to None.
initial_last_modifiedThe initial last modified date to use for incremental loading. This is useful when we want to load only the records that have been modified since a certain date. Defaults to None. If provided, it must be a string in Salesforce datetime format (with informed timezone).
Properties
column_name_strategyLiteral['columnName', 'label']credentialsSalesforceCredentials | SalesforceTokenCredentialsfilterlist[tuple[str, str, str]] | Nonefilter_logicstr | Nonefind_report_byLiteral['id', 'name']initial_valuesdictReturn a dictionary with the initial values to be stored after execution of the plugin. They will be accessible in the next execution of the plugin. The dictionary must have the parameter names as keys and the initial values as values, all the type string.
Returns: dict: A dictionary with the initial values of the parameters of the plugin.
reportlist[str]Methods
chunkdef chunk(working_dir: str) -> list[str]
Trigger the import of the data. This must be implemented in any class that inherits from this class unless directly implementing streaming. The method will receive a folder where it must store the data as parquet files, and return a list of the paths of the files created. This files will then be loaded and mapped to the dataset function in positional order, so if you want file.parquet to be the first argument of the dataset function, you must return it first. If you want a parameter to receive multiple files, return a list of the paths. For example, you would give the following return to provide a first argument with a single file and a second argument with two files:return ["file1.parquet", ["file2.parquet", "file3.parquet"]]
Parameters:
working_dirstrThe folder where the files must be stored
Returns:
Union[str, Tuple[str, ...], List[str]]: The path of the file(s) created, in the order they must be mapped to the dataset function