Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simonw/sqlite-utils-jq
Plugin adding a jq() SQL function to sqlite-utils
https://github.com/simonw/sqlite-utils-jq
Last synced: 4 months ago
JSON representation
Plugin adding a jq() SQL function to sqlite-utils
- Host: GitHub
- URL: https://github.com/simonw/sqlite-utils-jq
- Owner: simonw
- Created: 2023-08-11T00:45:35.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-11T00:53:58.000Z (over 1 year ago)
- Last Synced: 2024-10-06T20:24:09.432Z (5 months ago)
- Language: Python
- Size: 2.93 KB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# sqlite-utils-jq
[](https://pypi.org/project/sqlite-utils-jq/)
[](https://github.com/simonw/sqlite-utils-jq/releases)
[](https://github.com/simonw/sqlite-utils-jq/actions?query=workflow%3ATest)
[](https://github.com/simonw/sqlite-utils-jq/blob/main/LICENSE)Plugin adding a `jq()` SQL function to [sqlite-utils](https://sqlite-utils.datasette.io/).
## Installation
Install this plugin in the same environment as `sqlite-utils`:
```bash
sqlite-utils install sqlite-utils-jq
```## Usage
This plugin adds a `jq()` function for executing [jq](https://jqlang.github.io/jq/) programs against JSON values.
```bash
sqlite-utils memory "select jq(:doc, :expr) as result" \
-p doc '{"foo": "bar"}' \
-p expr '.foo' \
--table
```
Output:
```
result
--------
"bar"
```## Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd sqlite-utils-jq
python3 -m venv venv
source venv/bin/activateNow install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest