This page provides you with instructions on how to extract data from Mailjet and load it into Google BigQuery. (If this manual process sounds onerous, check out Stitch, which can do all the heavy lifting for you in just a few clicks.)
Mailjet is an email automation platform used to set up marketing campaigns as well as shoot off transactional emails. It's a popular tool for those looking to combine these two tasks in an easy to use interface with a scalable pricing structure. The data from Mailjet is simple but can be very useful. Mailjet stores data on bounce rate, click stats, and opening information. This data is useful when it comes time to quantify the effectiveness of your email strategy.
What is Google BigQuery?
Google BigQuery is a data warehouse that delivers super-fast results from SQL queries, which it accomplishes using a powerful engine dubbed Dremel. With BigQuery, there's no spinning up (and down) clusters of machines as you work with your data. With all of that said, it's clear why some claim that BigQuery prioritizes querying over administration. It's super fast, and that's the reason why most folks use it.
Getting data out of Mailjet
You can collect Mailjet data using Webhooks. Once you’ve set up HTTP endpoints, Mailjet will begin sending data via the POST request method. Data will be enclosed in the body of the request in JSON format.
Loading data into Google BigQuery
Google Cloud Platform offers a helpful guide for loading data into BigQuery. You can use the
bq command-line tool to upload the files to your awaiting datasets, adding the correct schema and data type information along the way. The
bq load command is your friend here. You can find the syntax in the bq command-line tool quickstart guide. Iterate through this process as many times as it takes to load all of your tables into BigQuery.
Keeping Mailjet data up to date
So what’s next? By now your script can move the data that you need into your warehouse. What happens when Mailjet sends a data type that your script doesn’t recognize? It’s also important to consider the situation where an entry in Redshift needs to be updated to a new value. Once you have build in that functionality, you can set your script up as a cron job or continuous loop to keep pulling new data as it appears.
Other data warehouse options
BigQuery is really great, but sometimes you need to optimize for different things when you're choosing a data warehouse. Some folks choose to go with Postgres or Redshift, which are two RDBMSes that use similar SQL syntax. If you're interested in seeing the relevant steps for loading this data into Postgres or Redshift, check out To Redshift and To Postgres.
Easier and faster alternatives
If all this sounds a bit overwhelming, don’t be alarmed. If you have all the skills necessary to go through this process, chances are building and maintaining a script like this isn’t a very high-leverage use of your time.
Thankfully, products like Stitch were built to solve this problem automatically. With just a few clicks, Stitch starts extracting your Mailjet data via the API, structuring it in a way that is optimized for analysis, and inserting that data into your Google BigQuery data warehouse.