simonw / simonw/sqlite-utils

Ability to load JSON records held in a file with a single top level key that is a list of objects

Open
#489 9 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cli-tool enhancement
Dominant language
Python
Stars
2.2k
Forks
172
Avg merge
9m
Merged PRs (30d)
1

Description

It's very common for JSON to look like this:

{
  "Version": "5.5.52.6",
  "List": [
    {
      "Description": "Nonpartisan",
      "Id": 1,
      "ExternalId": ""
    },
    {
      "Description": "Undeclared",
      "Id": 2,
      "ExternalId": ""
    }
  ]
}

This example taken from the records downloaded from https://www.elections.alaska.gov/election-results/e/

Right now you can't import this into sqlite-utils - you need to run it through jq .List first.

But since this is so common, it would be neat if sqlite-utils could have a rule of thumb that says "if it's an object, but it has a single key that is is a list of objects, use that instead".

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named in the issue. Start by locating the sqlite-utils JSON import entry point and its existing tests; use the Alaska-shaped example to define the single-key list-of-objects case, then verify that regular JSON objects and other imports still behave as before.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sqlite
Domain
cli, database
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.