Name | sqlite-utils-ask JSON |
Version |
0.2
JSON |
| download |
home_page | None |
Summary | Ask questions of your data with LLM assistance |
upload_time | 2024-11-24 20:40:55 |
maintainer | None |
docs_url | None |
author | Simon Willison |
requires_python | None |
license | Apache-2.0 |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# sqlite-utils-ask
[![PyPI](https://img.shields.io/pypi/v/sqlite-utils-ask.svg)](https://pypi.org/project/sqlite-utils-ask/)
[![Changelog](https://img.shields.io/github/v/release/simonw/sqlite-utils-ask?include_prereleases&label=changelog)](https://github.com/simonw/sqlite-utils-ask/releases)
[![Tests](https://github.com/simonw/sqlite-utils-ask/workflows/Test/badge.svg)](https://github.com/simonw/sqlite-utils-ask/actions?query=workflow%3ATest)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/sqlite-utils-ask/blob/main/LICENSE)
Ask questions of your data with LLM assistance
## Installation
Install this plugin in the same environment as sqlite-utils.
```bash
sqlite-utils install sqlite-utils-ask
```
## sqlite-utils ask
Ask questions of a SQLite database file like this:
```bash
sqlite-utils ask content.db 'How many repos?'
```
The tool will use an LLM (`gpt-4o-mini` by default) to generate the appropriate SQL query by passing through your question and the database schema, and will then execute the query and return the result.
## sqlite-utils ask-files
You can also ask questions directly of CSV, TSV or JSON files. These will be imported into an in-memory SQLite database prior to running the query.
```bash
sqlite-utils ask-files data.csv 'How many repos?'
```
You can pass multiple files and run queries across multiple resulting tables.
```bash
sqlite-utils ask-files legislators.csv votes.csv 'How many votes did each legislator cast?'
```
## Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
```bash
cd sqlite-utils-ask
python -m venv venv
source venv/bin/activate
```
Now install the dependencies and test dependencies:
```bash
pip install -e '.[test]'
```
To run the tests:
```bash
python -m pytest
```
To capture new HTTP interactions, run:
```bash
PYTEST_OPENAI_API_KEY=your-key python -m pytest --record-mode once
```
Or use `--record-mode all` to re-record all interactions.
Raw data
{
"_id": null,
"home_page": null,
"name": "sqlite-utils-ask",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Simon Willison",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/33/b1/169a2f91c8a95dc35173c1851511449282ecc8a786feb8d6d7a977eb2f88/sqlite_utils_ask-0.2.tar.gz",
"platform": null,
"description": "# sqlite-utils-ask\n\n[![PyPI](https://img.shields.io/pypi/v/sqlite-utils-ask.svg)](https://pypi.org/project/sqlite-utils-ask/)\n[![Changelog](https://img.shields.io/github/v/release/simonw/sqlite-utils-ask?include_prereleases&label=changelog)](https://github.com/simonw/sqlite-utils-ask/releases)\n[![Tests](https://github.com/simonw/sqlite-utils-ask/workflows/Test/badge.svg)](https://github.com/simonw/sqlite-utils-ask/actions?query=workflow%3ATest)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/sqlite-utils-ask/blob/main/LICENSE)\n\nAsk questions of your data with LLM assistance\n\n## Installation\n\nInstall this plugin in the same environment as sqlite-utils.\n```bash\nsqlite-utils install sqlite-utils-ask\n```\n## sqlite-utils ask\n\nAsk questions of a SQLite database file like this:\n\n```bash\nsqlite-utils ask content.db 'How many repos?'\n```\nThe tool will use an LLM (`gpt-4o-mini` by default) to generate the appropriate SQL query by passing through your question and the database schema, and will then execute the query and return the result.\n\n## sqlite-utils ask-files\n\nYou can also ask questions directly of CSV, TSV or JSON files. These will be imported into an in-memory SQLite database prior to running the query.\n\n```bash\nsqlite-utils ask-files data.csv 'How many repos?'\n```\nYou can pass multiple files and run queries across multiple resulting tables.\n\n```bash\nsqlite-utils ask-files legislators.csv votes.csv 'How many votes did each legislator cast?'\n```\n\n## Development\n\nTo set up this plugin locally, first checkout the code. Then create a new virtual environment:\n```bash\ncd sqlite-utils-ask\npython -m venv venv\nsource venv/bin/activate\n```\nNow install the dependencies and test dependencies:\n```bash\npip install -e '.[test]'\n```\nTo run the tests:\n```bash\npython -m pytest\n```\nTo capture new HTTP interactions, run:\n```bash\nPYTEST_OPENAI_API_KEY=your-key python -m pytest --record-mode once\n```\nOr use `--record-mode all` to re-record all interactions.\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Ask questions of your data with LLM assistance",
"version": "0.2",
"project_urls": {
"CI": "https://github.com/simonw/sqlite-utils-ask/actions",
"Changelog": "https://github.com/simonw/sqlite-utils-ask/releases",
"Homepage": "https://github.com/simonw/sqlite-utils-ask",
"Issues": "https://github.com/simonw/sqlite-utils-ask/issues"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5f23370b67bdfb820ecdf513f7f4861f25a551df0addcee815c5281806d2630b",
"md5": "314a26d01b6f4934b9357405281dbc67",
"sha256": "ab9fb445987e230a66361c5bbf99d9ecf8670bf3c08367f445875862f0faa01e"
},
"downloads": -1,
"filename": "sqlite_utils_ask-0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "314a26d01b6f4934b9357405281dbc67",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 9138,
"upload_time": "2024-11-24T20:40:53",
"upload_time_iso_8601": "2024-11-24T20:40:53.490732Z",
"url": "https://files.pythonhosted.org/packages/5f/23/370b67bdfb820ecdf513f7f4861f25a551df0addcee815c5281806d2630b/sqlite_utils_ask-0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "33b1169a2f91c8a95dc35173c1851511449282ecc8a786feb8d6d7a977eb2f88",
"md5": "d996fd59088f533938b57ba2c09d10f0",
"sha256": "6c53244899558fe4c777ddf53f1cf5ade1a6c641fea318f71110d97a3903686a"
},
"downloads": -1,
"filename": "sqlite_utils_ask-0.2.tar.gz",
"has_sig": false,
"md5_digest": "d996fd59088f533938b57ba2c09d10f0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9084,
"upload_time": "2024-11-24T20:40:55",
"upload_time_iso_8601": "2024-11-24T20:40:55.257554Z",
"url": "https://files.pythonhosted.org/packages/33/b1/169a2f91c8a95dc35173c1851511449282ecc8a786feb8d6d7a977eb2f88/sqlite_utils_ask-0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-24 20:40:55",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "simonw",
"github_project": "sqlite-utils-ask",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "sqlite-utils-ask"
}