Mailchimp + Steampipe
Steampipe is an open-source zero-ETL engine to instantly query cloud APIs using SQL.
Mailchimp is a marketing automation and email marketing platform.
List details of your Mailchimp campaign:
select id, title, content_type, create_time, emails_sent, send_time, status, typefrom mailchimp_campaign;
+------------+------------------------------------+--------------+---------------------------+-------------+-----------+--------+------------------+| id | title | content_type | create_time | emails_sent | send_time | status | type |+------------+------------------------------------+--------------+---------------------------+-------------+-----------+--------+------------------+| f739729f66 | We're here to help you get started | template | 2023-06-16T17:51:52+05:30 | <null> | <null> | save | automation-email |+------------+------------------------------------+--------------+---------------------------+-------------+-----------+--------+------------------+
Documentation
Quick start
Install
Download and install the latest Mailchimp plugin:
steampipe plugin install mailchimp
Credentials
Item | Description |
---|---|
Credentials | Mailchimp requires an API key for all requests. |
Permissions | API keys have the same permissions as the user who creates them, and if the user permissions change, the API key permissions also change. |
Radius | Each connection represents a single Mailchimp Installation. |
Resolution | 1. Credentials explicitly set in a steampipe config file (~/.steampipe/config/mailchimp.spc )2. Credentials specified in environment variables, e.g., MAILCHIMP_API_KEY . |
Configuration
Installing the latest mailchimp plugin will create a config file (~/.steampipe/config/mailchimp.spc
) with a single connection named mailchimp
:
connection "mailchimp" { plugin = "mailchimp"
# Mailchimp API key for requests. Required. # Generate your API Key as per: https://mailchimp.com/developer/marketing/guides/quick-start/#generate-your-api-key/ # This can also be set via the `MAILCHIMP_API_KEY` environment variable. # api_key = "08355689e3e6f9fd0f5630362b16b1b5-us21"}
Alternatively, you can also use the standard Mailchimp environment variables to obtain credentials only if other argument (api_key
) is not specified in the connection:
export MAILCHIMP_API_KEY=q8355689e3e6f9fd0f5630362b16b1b5-us21
Postgres FDW
This plugin is available as a native Postgres FDW. Unlike Steampipe CLI, which ships with an embedded Postgres server instance, the Postgres FDW can be installed in any supported Postgres database version.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_postgres_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/postgres.sh)" -- mailchimp
The installer will prompt you for the plugin name and version, download and install the appropriate files for your OS, system architecture, and Postgres version.
To configure the Postgres FDW, you will create an extension, foreign server, and schema and import the foreign schema.
CREATE EXTENSION IF NOT EXISTS steampipe_postgres_mailchimp;CREATE SERVER steampipe_mailchimp FOREIGN DATA WRAPPER steampipe_postgres_mailchimp OPTIONS (config '<your_config>');CREATE SCHEMA mailchimp;IMPORT FOREIGN SCHEMA mailchimp FROM SERVER steampipe_mailchimp INTO mailchimp;
SQLite Extension
This plugin is available as a SQLite Extension, making the tables available as SQLite virtual tables.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_sqlite_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/sqlite.sh)" -- mailchimp
The installer will prompt you for the plugin name, version, and destination directory. It will then determine the OS and system architecture, and it will download and install the appropriate package.
To configure the SQLite extension, load the extension module and then run the steampipe_configure_mailchimp
function to configure it with plugin-specific options.
$ sqlite3sqlite> .load ./steampipe_sqlite_extension_mailchimp.sosqlite> select steampipe_configure_mailchimp('<your_config>');
Export
This plugin is available as a standalone Export CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- mailchimp
You can pass the configuration to the command with the --config
argument:
steampipe_export_mailchimp --config '<your_config>' <table_name>