Salesforce Marketing Cloud Query

Salesforce Marketing Cloud Query

This component uses the Salesforce Marketing Cloud API to retrieve data and load it into a table. This stages the data, so the table is reloaded each time. You may then use transformations to enrich and manage the data in permanent tables.

The component offers both a Basic and Advanced mode (see below) for generating the Salesforce Marketing Cloud API query. Note that although this is exposed in an SQL-like language, the exact semantics can be surprising - for example filtering on a column can return more data than not filtering on it, an impossible scenario with regular SQL.

Warning: This component is potentially destructive. If the target table undergoes a change in structure, it will be recreated. Otherwise, the target table is truncated. Setting the Load Option 'Recreate Target Table' to 'Off' will prevent both recreation and truncation. Do not modify the target table structure manually.


Properties

Property Setting Description
Name Text The descriptive name for the component.
Basic/Advanced Mode Select Basic: This mode will build a Salesforce Marketing Cloud Query for you using settings from Data Source, Data Selection, and Data Source Filter parameters. In most cases, this will be sufficient.
Advanced: This mode will require you to write an SQL-like query that is translated into one or more Salesforce Marketing Cloud API calls. The available fields and their descriptions are documented in the Data Model
Use Sandbox Select (SOAP only) Choose if want to enter a non-production environment.
Service Type Select Choose if you want to connect to the SOAP or REST API. SOAP asks for a username and password. REST asks for an OAuth.
Username Text (SOAP only) Enter your username.
Password Text (SOAP only) Enter your password.
Authentication Select (REST only) Select an authentication method, which must be set up in advance. Salesforce Marketing Cloud uses the OAuth standard for authenticating 3rd party applications. More help is provided in the setup screens for Manage OAuth.
Note: The data sources available are dependent on the selected Authentication Method.
Connection Options Parameter A JDBC parameter supported by the Database Driver and listed in the Data Model. The available parameters are determined automatically from the driver, and may change from version to version.
They are usually not required, since sensible defaults are assumed.
Value A value for the given parameter.
Instance Text (SOAP only) Choose your instance type. This is set to S7 by default but should be set to S10 for Matillion ETL.
Data Source Choice Select a Data Source. Default Data Sources can be found in the Data Model
Data Selection Choice Select one or more columns to return from the query.
Combine Filters Text Use the defined filters in combination with one another according to either and or or.
Limit Number Fetching a large number of results from Salesforce Marketing Cloud will use multiple API calls. These calls are rate-limited by the provider, so fetching a very large number may result in errors.
Type Select Choose between using a standard table or an external table.
Standard: The data will be staged on an S3 bucket before being loaded into a table.
External: The data will be put into an S3 Bucket and referenced by an external table.
Warehouse Select Choose a Snowflake warehouse that will run the load.
Database Select Choose a database to create the new table in.
Project Text The target BigQuery project to load data into.
Dataset Text The target BigQuery dataset to load data into.
Schema Select Select the table schema. The special value [Environment Default] will use the schema defined in the environment. For more information on using multiple schemas, see this article.
Note: An external schema is required if the 'Type' property is set to 'External'.
Staging Select Snowflake Managed: Allow Matillion ETL to create and use a temporary internal stage on Snowflake for staging the data. This stage, along with the staged data, will cease to exist after loading is complete.
(AWS Only) Existing Amazon S3 Location: Selecting this will avail the user of properties to specify a custom staging area on S3.
(Azure only) Existing Azure Blob Storage Location: Selecting this will avail the user of properties to specify a custom staging location on Azure.
Storage Account Select (Azure only) Select a Storage Account with your desired Blob Container to be used for staging the data.
Blob Container Select (Azure only) Select a Blob Container to be used for staging the data.
Target Table Text Provide a new table name.
Warning: This table will be recreated and will drop any existing table of the same name.
S3 Staging Area Text (AWS Only) The name of an S3 bucket for temporary storage. Ensure your access credentials have S3 access, as well as permission to write to the bucket. See this document for details on setting up access. The temporary objects created in this bucket will be removed again after the load completes, they are not kept.
This property is available when using an Existing Amazon S3 Location for Staging.
Distribution Style Select Auto: (Default) Allow Redshift to manage your distribution style.
Even: Distributes rows around the Redshift cluster evenly.
All: Copy rows to all nodes in the Redshift cluster.
Key: Distribute rows around the Redshift cluster according to the value of a key column.
Table distribution is critical to good performance. See the Amazon Redshift documentation for more information.
Sort Key Select This is optional, and specifies the columns from the input that should be set as the table's sort key.
Sort keys are critical to good performance - see the Amazon Redshift documentation for more information.
Primary Key Select Choose your Primary Key. This is to uniquely identify table records.
Encryption Select (AWS Only) Decide on how the files are encrypted inside the S3 Bucket. This property is available when using an Existing Amazon S3 Location for Staging.
None: No encryption.
SSE KMS: Encrypt the data according to a key stored on KMS.
SSE S3: Encrypt the data according to a key stored on an S3 bucket
Load Options Multiple Select Columns Comp Update: Apply automatic compression to the target table (if ON). Default is ON.
Stat Update: Automatically update statistics when filling a table (if ON). Default is ON. In this case, it is updating the statistics of the target table.
Clean S3 Objects: Automatically remove UUID-based objects on the S3 Bucket (if ON). Default is ON. Effectively decides whether to keep the staged data in the S3 Bucket or not.
String Null is Null: Converts any strings equal to "null" into a null value. This is case sensitive and only works with entirely lower-case strings. Default is ON.
Recreate Target Table: Choose whether the component recreates its target table before the data load. If OFF, the existing table will be used. Default is ON.
File Prefix: Give staged file names a prefix of your choice. Default is empty (no prefix).
Load Options Multiple Selection Clean Staged Files: Destroy staged files after loading data. Default is ON.
String Null is Null: Converts any strings equal to "null" into a null value. This is case sensitive and only works with entirely lower-case strings. Default is ON.
Recreate Target Table: Choose whether the component recreates its target table before the data load. If OFF, the existing table will be used. Default is ON.
File Prefix: Give staged file names a prefix of your choice. Default is empty (no prefix).
Trim String Columns: Choose whether to remove leading and trailing characters from a string column.
Use Grid Variable: Check this checkbox to use a grid variable.
Load Options Multiple Select Clean Cloud Storage Files: (If ON) Destroy staged files on Cloud Storage after loading data. Default is ON.
Cloud Storage File Prefix: Give staged file names a prefix of your choice. Default is empty (no prefix).
Recreate Target Table: Setting this Load Option to OFF will prevent both recreation and truncation of the target table.
Use Grid Variable: Check this checkbox to use a grid variable.
Cloud Storage Staging Area Text The URL and path of the target Google Storage bucket to be used for staging the queried data.
Encryption Select (AWS Only) Decide on how the files are encrypted inside the S3 Bucket.This property is available when using an Existing Amazon S3 Location for Staging.
None: No encryption.
SSE KMS: Encrypt the data according to a key stored on KMS.
SSE S3: Encrypt the data according to a key stored on an S3 bucket
Auto Debug Select Choose whether to automatically log debug information about your load. These logs can be found in the Task History and should be included in support requests concerning the component. Turning this on will override any debugging Connection Options.
Debug Level Select The level of verbosity with which your debug information is logged. Levels above 1 can log huge amounts of data and result in slower execution.

1: Will log the query, the number of rows returned by it, the start of execution and the time taken, and any errors.

2: Will log everything included in Level 1, plus cache queries and additional information about the request, if applicable.

3: Will additionally log the body of the request and the response.

4: Will additionally log transport-level communication with the data source. This includes SSL negotiation.

5: Will additionally log communication with the data source, as well as additional details that may be helpful in troubleshooting problems. This includes interface commands.

Strategy

Connect to the target database and issue the query. Stream the results into objects on S3. Then create or truncate the target table and issue a COPY command to load the S3 objects into the table. Finally, clean up the temporary S3 objects.

Example

This job will load data from the Salesforce Marketing Cloud database into a table called "emails_table".

The next image shows the query's Properties. We want to retrieve information about orders in Salesforce Marketing Cloud, so the data source is 'Email'. For the Data Selection, we are selecting all columns. The default limit of 100 is kept to control the number of API calls made.

Below is an example of the email data retrieved when using the Sample tab.