Data download
You can download a snapshot of the whole catalog as one SQLite file. We make a new one every week. Query it offline, load it into your own tools, or use it to start a copy that you keep up to date yourself.
Or from a terminal:
curl -LO https://findopera.com/findopera.db.zip
unzip findopera.db.zip
sqlite3 findopera.dbWhat's in it
One table for each table in the catalog: operas, recordings, casts, people, releases and their links to streaming services, joined by id. Unzipped, it is about 8 MB.
SELECT o.title, c.last_name, count(*) AS recordings
FROM operas o
JOIN composers c ON c.id = o.composer_id
JOIN recordings r ON r.opera_id = o.id
GROUP BY o.id ORDER BY recordings DESC LIMIT 5;It has no accounts, no collections and no edit history. The history is in the API's change log.
How we make it
Every Monday, a scheduled job runs sync_catalog.py against the public GraphQL API, starting from an empty file and without a token. The script reads the API's change log, recordChanges, from the beginning and applies each change in order. So the file holds nothing the API does not give anyone, and you can build the same file yourself. It takes about ten minutes.
curl -O https://findopera.com/examples/sync_catalog.py
python3 sync_catalog.py findopera.dbKeeping it current
The file records how far into the change log it got. Run the script on a downloaded snapshot and it fetches only the changes made since, which usually takes seconds.
When the catalog gains a table, a copy of the script from before it skips that table's changes, keeps everything else current, and says what it skipped. Download the current script and it fills the new table in from the start of the change log.
Resources
- sync_catalog.py: the script that builds the file, in Python with nothing to install.
- GraphQL API: how the change log works, and the rest of the API.