Skip to content

ae9is/amazon-reviews

Repository files navigation

amazon-reviews

Spring GraphQL API based on normalising the Amazon Reviews 2023 dataset in Postgres.

Data

See: https://huggingface.co/datasets/McAuley-Lab/Amazon-Reviews-2023/tree/main

The data needs to be downloaded and prepped for import into the database.

  1. Download the following files to data/import:

  2. Then run the following task:

    make parse

Note: Feel free to download, merge, and parse the data for all of the categories—but it's a lot bigger!

Run

To run the Spring api and Postgres database via Docker:

direnv allow
make docker-build
docker compose up -d

Open http://localhost:4000/graphiql?path=/graphql

You can also directly run the Spring api at the same time with:

make run

Open http://localhost:8080/graphiql?path=/graphql

Test

With the Postgres database started:

make test

Database

Migrations

Bring up the database instance with Docker and then:

# Create and load tables
bash docker-db-up.sh

# Dump and drop tables
bash docker-db-down.sh

CLI

To get a shell to the running Postgres instance:

make docker-bash-db
postgres@...$ psql test
test=# \d