Mailchimp Query

Mailchimp Query

This component uses the Mailchimp 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.

Warning: This component is destructive as it truncates or recreates its target table on each run. Do not modify the target table structure manually.
 

Properties

Property Setting Description
Name Text The descriptive name for the component.
Basic/Advanced Mode Choice Basic - This mode will build a Mailchimp 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 which is translated into one or more Mailchimp API calls. The available fields and their descriptions are documented in the data model.
Authentication Method Choice Select an authentication method. Mailchimp gives the opion of using OAuth or an API. Each requires a unique set of properties for the component.
Data Source Choice Select a data source from a list that is generated using the completed authentication and connection properties.
Data Selection Choice Select one or more columns to return from the query.
Data Source Filter Input Column The available input columns vary depending upon the Data Source.
Qualifier Is - Compares the column to the value using the comparator.
Not - Reverses the effect of the comparison, so "equals" becomes "not equals", "less than" becomes "greater than or equal to" etc.
Comparator Equals - The only supported comparator for Mailchimp is Equals.
Value The value to be compared.
SQL Text Custom SQL-like query only available during 'Advanced' mode.
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 Mailchimp will use multiple API calls. These calls are rate-limited by the provider, so fetching a very large number may result in errors.
Connection Options Parameter A JDBC parameter supported by the Database Driver. The available parameters are determined automatically from the driver, and may change from version to version.
They are usually not required as sensible defaults are assumed.
Value A value for the given Parameter.
S3 Staging Area Text The name of an S3 bucket for temporary storage. Ensure your access credentials have S3 access and 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.
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.
Target Table Text Provide a new table name.
Warning: This table will be recreated and will drop any existing table of the same name.
Distribution Style Select Even - the default option, distribute 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.
Table Distribution Key Select This is only displayed if the Table Distribution Style is set to Key. It is the column used to determine which cluster node the row is stored on.
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.
Load Options Multiple Selection 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.
Project Text The target BigQuery project to load data into.
Dataset Text The target BigQuery dataset to load data into.
Cloud Storage Staging Area Text The URL and path of the target Google Storage bucket to be used for staging the queried data.

 

Additional OAuth Properties
Property Setting Description
Authentication Select Select the set of credentials to use to connect to Mailchimp. These must be set up in advance, using Project → Manage OAuth.
Data Centre Text Provide an address for the desired Mailchimp server.
Additional API Properties
Property Setting Description
API Key Select This is only displayed if the Table Distribution Style is set to Key. It is the column used to determine which cluster node the row is stored on.


Variable Exports

This component makes the following values available to export into variables:

Source Description
Component Name of the component.
Status Successful or Unsuccessful.
Started At Time Component began.
Completed At Time Component finished.
Duration Duration of Component's run.
Row Count Number of Rows queried by the component.
Message Any messages yielded by the component (usually empty).
 


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 example uses the Mailchimp Query Component to copy data from a Mailchimp server, to an S3 Bucket and then finally load the data into a Redshift table. The table itself is created by the Create/Replace Table Component and is called 'Campaign_Details'.

 

The Mailchimp properties are set up to use an API Key as the Authentication Method. An API key taken from the Mailchimp account is entered and the Data Selection property will automatically load and display any available data connected to the account, from which we select CampaignFeedback. The Mailchimp Query Component will then put this data onto the specified S3 Bucket and from there load the data into the Redshift table specified in the Target Table property.