Skip to content

Latest commit

 

History

History
45 lines (29 loc) · 1.57 KB

README.md

File metadata and controls

45 lines (29 loc) · 1.57 KB

rebrickable-sqlite

Build Netlify Status

This is set of scripts to create a local copy of the Rebrickable database. It uses the CSV dumps provided by Rebrickable and is a relatively quick and easy way to create a local copy of all Lego parts and set inventories.

It includes custom views and indices to make working with this data more efficient.

Getting started

Simply run make. You will need sqlite3 and curl installed if they are not already.

This will download the table data from Rebrickable and import it into an SQLite database. The output database file is dist/bricks.db.

Alternatively, you can download a complete version of the database directly, but this won't include the newest set and element updates.

Example queries

List all colors

select id, name 
from colors;

Get all parts in a set

select part_num, color_id, quantity
from set_parts
where set_num = '10193-1';

List top 10 parts based on the number of sets they are in

select part_num, num_sets
from part_info
order by num_sets desc limit 10;

More examples

These examples, along with others, are available in the runable SQLite script examples.sql.