January special Unlock the power of personalization with Segments and get a free flow review
Book a Klaviyo flow review
All blog posts

Backing Up Your Shopify Data

August 25, 2020

In the event the unthinkable happens, you will want to be able to reconstruct your business history and not lose all of the valuable data and learnings.

Backing up your Shopify data

Shopify has a great ecommerce platform, but they are still a single point of failure for a possible catastrophic data loss that wipes out all record of what you’ve built in your store and business. (Or worse, arbitrary censorship or other obscure reasons for kicking you off their platform 🙈.) In the event the unthinkable happens, you will want to be able to reconstruct your business history and not lose all of the valuable data and learnings.

Other reasons you may want to back up your data include recreating your store data for analysis, or possibly migrating to another platform later on.

In this post I will guide you on how to back up all of the important pieces of your Shopify in a more scalable way than just CSV exports.

The Unscalable Way

CSV Exports

You may have already been making a habit of exporting all of your orders, products, and customers directly from the Shopify dashboard. This is a fine initial solution — but you may soon be bothered by the .csv files piling up, growing file sizes, and repetitive effort to download. For a fast and ad hoc backup however you can’t beat the CSV exports.

The Scalable Way

For the the actual real guide to backing up your Shopify data, you’re going to need the following coding stack (or refer to your resident developer). What we’re going to end up with is a mini relational database that represents your entire Shopify business, which will then allow you to reconstruct your business history (if needed), and even do cool things like run SQL queries against it for your own analyses.


  • MacOS
  • Python 3
  • SQLite


Create a new directory for your Shopify backup and set up a Python virtual environment:

Activate your virtual environment and install the necessary packages:

Configure Shopify API credentials

Create a .env environment configuration file to hold your Shopify API credentials. You can get an API key by going to your Shopify admin dashboard and navigating to Apps -> Private apps -> Create private app. Call your app simply "Shopify backup" with all of the default settings, and you should get an API key and and Password. Set these in your .env file.

And in the file:

Write backup script

Create a new Python file called "backup.py" and plunk the following code into it. We won't go through the specifics here, but the end results will be a lightweight SQLite database that holds all of your Shopify data.

You can get the full source code from our Github repo.

One thing to note is that we simplified which fields we pull in; there are lots of other possible fields you can back up, so check out the Shopify API docs to get the full list.

Run the script

Depending on how much data you have, the script may take a while; there are a few helpful command line messages, but you can add your own to better track the progress.

After the script completes you should have a "db.sqlite3" file holding all of your data. As you continue to get more data and grow your store, you can simply go back and re-run the script to update all of your existing data and pull in new entries.

Using Your Backup

All of the different ways you can use your backup data is beyond the scope of this guide, but to get started you can fire up your SQLite interactive command line and check out what you have:

And run some queries:


We went through a simple guide on how to back up all of your Shopify data for various reasons including catastrophe data loss insurance, censorship, custom analysis, or migration. Once you've backed up your data, the sky(net)'s the limit for what you can do with it!

Alex Greifeld from No Best Practices

Alex Greifeld

No Best Practices
Sharad Thaper from Hidden Tempo

Sharad Thaper

Hidden Tempo

Read more