Giter Site home page Giter Site logo

Json file? about chinook-database HOT 4 CLOSED

lerocha avatar lerocha commented on August 22, 2024
Json file?

from chinook-database.

Comments (4)

SubOptimal avatar SubOptimal commented on August 22, 2024 1

I've used DB Browser for SQLite to export the database.

The exported files look as

Album.json

[
    {
        "AlbumId": "1",
        "ArtistId": "1",
        "Title": "For Those About To Rock We Salute You"
    },
    {
        "AlbumId": "2",
        "ArtistId": "2",
        "Title": "Balls to the Wall"
    },

... truncated

Artist.json

[
    {
        "ArtistId": "1",
        "Name": "AC/DC"
    },
    {
        "ArtistId": "2",
        "Name": "Accept"
    },

... truncated

(the other files are omitted)

A simple usage example:

import pandas as pd
from tabulate import tabulate

with open('data/Album.json', 'r') as f:
    album_json = f.read()

with open('data/Artist.json', 'r') as f:
    artist_json = f.read()

album_df = pd.read_json(album_json)
artist_df = pd.read_json(artist_json)

# - merge the two DataFrames on column 'ArtistId'
# - drop the columns 'AlbumId', 'ArtistId'
merged_df = pd.merge(artist_df, album_df, on='ArtistId') \
    .drop(columns=['AlbumId', 'ArtistId'], axis=1)
# set the column labels
merged_df.columns = ['Artist', 'Album']

print(tabulate(merged_df, headers='keys', showindex=False))

output

Artist                Album
--------------------  -------------------------------------
AC/DC                 For Those About To Rock We Salute You
AC/DC                 Let There Be Rock
Accept                Balls to the Wall
Accept                Restless and Wild
Aerosmith             Big Ones

... truncated

from chinook-database.

marko-knoebl avatar marko-knoebl commented on August 22, 2024 1

To expand a little on the work of @pangoro24, here's both the data and the database schema as JSON:

https://github.com/marko-knoebl/chinook-database-json/tree/master/src

from chinook-database.

pangoro24 avatar pangoro24 commented on August 22, 2024

Just as reference, I extracted them and saved the json and txt files here>
https://github.com/pangoro24/chinook-refit/tree/master/backend/files

from chinook-database.

lerocha avatar lerocha commented on August 22, 2024

You can now find the JSON file that is used to generate all the chinook database SQL scripts in the Releases page assets.

https://github.com/lerocha/chinook-database/releases

Thank you!

from chinook-database.

Related Issues (16)

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.