Skip to main content

Ask questions of your data with LLM assistance

Project description

sqlite-utils-ask

PyPI Changelog Tests License

Ask questions of your data with LLM assistance

Installation

Install this plugin in the same environment as sqlite-utils.

sqlite-utils install sqlite-utils-ask

sqlite-utils ask

Ask questions of a SQLite database file like this:

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.

sqlite-utils ask-files data.csv 'How many repos?'

You can pass multiple files and run queries across multiple resulting tables.

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:

cd sqlite-utils-ask
python -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

python -m pytest

To capture new HTTP interactions, run:

PYTEST_OPENAI_API_KEY=your-key python -m pytest --record-mode once

Or use --record-mode all to re-record all interactions.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqlite_utils_ask-0.2.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

sqlite_utils_ask-0.2-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file sqlite_utils_ask-0.2.tar.gz.

File metadata

  • Download URL: sqlite_utils_ask-0.2.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for sqlite_utils_ask-0.2.tar.gz
Algorithm Hash digest
SHA256 6c53244899558fe4c777ddf53f1cf5ade1a6c641fea318f71110d97a3903686a
MD5 d996fd59088f533938b57ba2c09d10f0
BLAKE2b-256 33b1169a2f91c8a95dc35173c1851511449282ecc8a786feb8d6d7a977eb2f88

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqlite_utils_ask-0.2.tar.gz:

Publisher: publish.yml on simonw/sqlite-utils-ask

Attestations:

File details

Details for the file sqlite_utils_ask-0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for sqlite_utils_ask-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ab9fb445987e230a66361c5bbf99d9ecf8670bf3c08367f445875862f0faa01e
MD5 314a26d01b6f4934b9357405281dbc67
BLAKE2b-256 5f23370b67bdfb820ecdf513f7f4861f25a551df0addcee815c5281806d2630b

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqlite_utils_ask-0.2-py3-none-any.whl:

Publisher: publish.yml on simonw/sqlite-utils-ask

Attestations:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page