Member-only story

Python HOW: Migrate Prodigy Database to MySQL or PostgreSQL Using Python

Gabriel Harris Ph.D.
3 min readOct 13, 2020

Learn how to save Prodigy annotations in a remote database for collaborative annotating

Photo edited by the author from prodi.gy

Prodigy is developed by Explosion AI, the folks behind spaCy, so it integrates with it organically 🍻. This article describes in detail how to migrate the default local SQLite database schema into a remote MySQL or PostgreSQL database

TL;DR: full code

Default Database 📍

The first time you run Prodigy, it will create a folder names .prodigy in your home directory with 2 files:

By default, Prodigy looks for its configuration in prodigy.json which has the default database "db": "sqlite”. So, by default, annotations are saved in the SQLite database prodigy.db. This is great to start labelling your data straight away without having to worry about where to save them

Remote Server 🌍

If the task requires multiple annotators, or you want to save your annotations on a remote MySQL or PostgreSQL server, you…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Gabriel Harris Ph.D.
Gabriel Harris Ph.D.

Written by Gabriel Harris Ph.D.

I’m an End-to-End Lead Data Scientist and Data Science Manager. My articles are love letters to my future self

Responses (2)

Write a response

Thanks a lot for the interesting article. I have two questions though.
1. Does the migration includes the database schema and data or is it only the schema? It is not super clear from the article.
2. How would it be different when I already have the…

Thanks, Gabriel. Great article.
To suggest one change: For Postgres, we need to add one more line before creating tables — db.bind(models.values()) apparently we need to re-bind the models to the postgres database.