GithubHelp home page GithubHelp logo

polygonhell / discogs-load Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dylanbartels/discogs-load

0.0 1.0 0.0 119 KB

Loads the discogs.com monthly XML data dump into postgres

License: MIT License

Rust 99.24% Dockerfile 0.76%

discogs-load's Introduction

Discogs-load

ci-workflow

A Rust application that inserts Discogs data dumps into Postgres.

Discogs-load uses a simple state machine with the quick-xml Rust library to parse the monthly data dump of discogs and load it into postgres. At moment of writing the largest file of the monthly dump is ~10 gb compressed and takes ~15 minutes to parse and load on a Mac air m1.

Inspired by discogs-xml2db and discogs2pg.

Local binary installation

Compile your own binary, which requires Rust.

cargo build --bin discogs-load --release
./target/release/discogs-load --help

Or download a compressed binary compiled by the Github actions from the Releases page for different platforms and architectures.

The binary needs to be made executable after downloading:

$ gunzip discogs-load-aarch64-apple-darwin.gz
$ chmod +x discogs-load-aarch64-apple-darwin
$ ./discogs-load-aarch64-apple-darwin --help
discogs-load 0.1.1

USAGE:
    discogs-load [OPTIONS] [FILE(S)]...

FLAGS:
    --create-indexes    Creates indexes
    -h, --help          Prints help information
    -V, --version       Prints version information

OPTIONS:
        --batch-size <batch-size>      Number of rows per insert [default: 10000]
        --db-host <db-host>            Database host [default: localhost]
        --db-name <db-name>            Database name [default: discogs]
        --db-password <db-password>    Database password [default: dev_pass]
        --db-user <db-user>            Database user [default: dev]

ARGS:
    <FILE(S)>...    Path to one or more discogs monthly data dump files, still compressed

Usage

Download the releases data dump here, and run the binary with the path to the gz compressed file(s) as only argument. For the example below we'll use a dockerized postgres instance.

docker-compose up -d postgres
./discogs-load-aarch64-apple-darwin discogs_20211201_releases.xml.gz discogs_20220201_labels.xml.gz

It is possible to afterwards run the innitalization of the project defined indexes.

./discogs-load-aarch64-apple-darwin --create-indexes

Datamodel

Datamodel

Tests

If you don't want to run the huge releases file, it is possible to run a smaller example file like so:

docker-compose up -d postgres
cargo run --bin discogs-load discogs-load/test_data/releases.xml.gz discogs-load/test_data/artists.xml.gz

And do a small manual test:

docker exec -it discogs-load-postgres-1 /bin/bash
psql -U dev discogs
select * from release;

discogs-load's People

Contributors

dylanbartels avatar polygonhell avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.