Trello to Redshift

This page provides you with instructions on how to extract data from Trello and load it into Amazon Redshift. (If this manual process sounds onerous, check out Stitch, which can do all the heavy lifting for you in just a few clicks.)

Pulling Data Out of Trello

In order to get your Trello data into AWS Redshift, you have to start by extracting it from Trello’s servers.  You can do this using the Trello API. Full API documentation is available online here.

The Trello API is actually quite simple in the grand scheme of APIs, and it endpoints that can provide information on boards, lists, cards, and actions. Using methods outlined in their API documentation, you can retrieve the data you’d like to place into Redshift.

Sample Trello Data

The Trello API returns JSON-formatted data. Below is an example of the kind of response you might see when querying for the details of a List.


[{
    "id": "4efe314cc72846af4e00008a",
    "data": {
        "list": {
            "id": "4eea4ffc91e31d174600004a",
            "name": "To Do Soon"
        },
        "board": {
            "id": "4eea4ffc91e31d1746000046",
            "name": "Example Board"
        },
        "old": {
            "name": "To Do Later"
        }
    },
    "date": "2011-12-30T21:46:52.874Z",
    "idMemberCreator": "4ee7deffe582acdec80000ac",
    "type": "updateList",
    "memberCreator": {
        "id": "4ee7deffe582acdec80000ac",
        "avatarHash": null,
        "fullName": "Joe Tester",
        "initials": "JT",
        "username": "joetester"
    }
}, {
    "id": "4efe3147c72846af4e00006d",
    "data": {
        "list": {
            "id": "4eea4ffc91e31d174600004a",
            "name": "To Do Later"
        },
        "board": {
            "id": "4eea4ffc91e31d1746000046",
            "name": "Example Board"
        },
        "old": {
            "name": "To Do Eventually"
        }
    },
    "date": "2011-12-30T21:46:47.843Z",
    "idMemberCreator": "4ee7deffe582acdec80000ac",
    "type": "updateList",
    "memberCreator": {
        "id": "4ee7deffe582acdec80000ac",
        "avatarHash": null,
        "fullName": "Joe Tester",
        "initials": "JT",
        "username": "joetester"
    }
}]

Preparing Trello Data for Redshift

OK, you’ve got the data. Now let’s put it somewhere. Once you’ve figured out what you want to pull down and how to pull it, you need to map the data that comes out of each relevant Trello API endpoint into a schema that can be inserted into a Redshift database.

This means that, for each value in the response, you need to identify a predefined datatype (i.e. INTEGER, DATETIME, etc.) and build a table that can receive them. The API documentation can give you a good sense of what fields will be provided by each endpoint, along with their corresponding datatypes.

Inserting Trello Data into Redshift

Once you have identified all of the columns you will want to insert, you can use the CREATE TABLE statement in Redshift to create a table that can receive all of this data.

With a table built, it may seem like the easiest way to add your data (especially if there isn’t much of it), is to build INSERT statements to add data to your Redshift table row-by-row. If you have any experience with SQL, this will be your gut reaction. But beware! Redshift isn’t optimized for inserting data one row at a time, and if you have any kind of high-volume data being inserted, you would be much better off loading the data into Amazon S3 and then using the COPY command to load it into Redshift.

Keeping Data Up-To-Date

Wow, you did it! Your Trello data has been loaded into Redshift! But what happens tomorrow when everything on your Trello account has changed as work gets done and new cards get made?

The key is to build your script in such a way that it can also identify incremental updates to your data. Thankfully, Trello’s API results include date fields that allow you to quickly identify records that are new since your last update (or since the newest record you’ve copied into Redshift). Also, the magnitude of data in any given Trello account is quite small compared to many “big data” sources, so you could just pull all of the data every time if you want to use a sledgehammer instead of a scalpel. You can set your script up as a cron job or continuous loop to keep pulling down new data as it appears.

Other Data Warehouse Options

Redshift is totally awesome, but sometimes you need to start smaller or optimize for different things. In this case, many people choose to get started with Postgres, which is an open source RDBMS that uses nearly identical SQL syntax to Redshift. If you’re interested in seeing the relevant steps for loading this data into Postgres, check out Trello 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 Trello data via the API, structuring it in a way that is optimized for analysis, and inserting that data into your Amazon Redshift data warehouse.