Skip to main content
Version: 1.3.0

SalesforceReportSource

class
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

Parent class for input plugins.

Methods: chunk(working_dir: str) -> Union[str, Tuple[str, ...], List[str]] Trigger the import of the data. 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"]]

Initializes the SalesforceReportSource with the report information and the credentials required to access Salesforce.

Parameters

parameter
credentialsSalesforceCredentials

The credentials to access Salesforce.

parameter
reportstr | list[str]

The 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.

parameter
column_name_strategyLiteral["columnName", "label"]

Indicates 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").

parameter
find_report_byLiteral["id", "name"], optional

Indicates whether the 'report' parameter contains report IDs or report names. If not provided, it will be inferred from the value of the 'report' parameter.

parameter
filtertuple[str, str, str] | list[tuple[str, str, str]], optional

A 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.

parameter
filter_logicstr, optional

A 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.

parameter
instance_urlstr, optional

The 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.

parameter
last_modified_columnstr, optional

The 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.

parameter
initial_last_modifiedstr, optional

The 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

property
column_name_strategyLiteral['columnName', 'label']

property
credentialsSalesforceCredentials | SalesforceTokenCredentials

property
filterlist[tuple[str, str, str]] | None

property
filter_logicstr | None

property
find_report_byLiteral['id', 'name']

property
initial_valuesdict

Return 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.

property
reportlist[str]

Methods

method
chunk
def 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:

parameter
working_dirstr

The 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