Ability to load JSON records held in a file with a single top level key that is a list of objects
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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