/batch_insert_workshop

This is used in a workshop to teach about batch inserting

Primary LanguageElixir

Batch Insert Workshop

To start your project:

Instructions

  1. Retrieve Unique Languages from JSON Payload.
  2. Insert all Unique Languages in one query, returning values (hint: Repo.insert_all with on_conflict & returning clause)
  3. Insert all Repos, and return all values from the Insert.
  4. Loop back through the payload, mapping the IDs returned from Languages and Repos (Steps 2 & 3)
  5. Insert these into the repo_languages table.
  6. Write tests

Where to begin:

  1. If you have a Github API Token set up (from Start your project section): You can run GithubApi.repos to fetch the first 10 repos. The file is located at lib/batch_insert_workshop/services/github_api.ex`

OR

  1. If you don't have a token set up, you can get a sample payload from: GithubPayload.sample

Tables to use for Part 1

  • Languages
  • Repos
  • Repo Languages

Located at: batch_insert_workshop/model/