PUBLISHED:
CATEGORY: Stripe ▸ Misc
TAGS: mysql

Download your Stripe data to a MySQL database

You can have all your Stripe data as MySQL tables in under a minute with the Table Dog CLI:

Start MySQL

# Note: Version <= 5.6 not supported.

# Version 5.7
docker run --platform linux/x86_64 -e MYSQL_ROOT_PASSWORD=my-secret-pw -p 3306:3306 -d mysql:5.7

# Version 8
docker run --platform linux/x86_64 -e MYSQL_ROOT_PASSWORD=my-secret-pw -p 3306:3306 -d mysql:8

Create a config file

Save this to a file called config.json:

{
    "cmd": {
        "fn": "download",
        "args": {
            "from": {
                "stripe": {
                    "secret_key": "sk_test_... download at https://dashboard.stripe.com/apikeys"
                }
            },
            "to": {
                "mysql": {
                    "addr": {
                        "ip": "127.0.0.1",
                        "port": 3306
                    },
                    "user": "root",
                    "pass": "my-secret-pw"
                }
            },
            "options": {
                "watch": true
            }
        }
    },
    "log": "info"
}

Note: This TypeScript file documents all possible CLI options.

Install the tdog CLI

# macOS:
curl -L --output /usr/local/bin/tdog https://github.com/tabledog/tdog-cli/releases/latest/download/tdog-x86_64-apple-darwin
chmod +x /usr/local/bin/tdog

Run tdog to download all of your tables

This will also poll the Stripe /events API and apply changes with less than a second delay.

tdog --json-file config.json