Skip to main content

Minimalist SQLite-based CLI tool with AI assistance for working with tabular data.

Project description

sqtab

PyPI version Python Versions License: MIT

sqtab is a minimalist command-line toolkit with AI assistance for working with tabular data
(CSV / JSON) using SQLite as a lightweight local database layer.

It is built for developers, data analysts, and engineers who want a fast and clean workflow without maintaining a full database runtime.

sqtab provides:

  • CSV / JSON → SQLite import
  • schema inspection & table listing
  • ad-hoc SQL execution
  • export to CSV / JSON
  • AI-assisted SQL generation (sqtab sql-ai)
  • AI-assisted table analysis (customizable tasks & rules)
  • optional user-defined AI model via SQTAB_AI_MODEL

Installation

pip install sqtab

Requires Python 3.10+.


Quick Start

Import CSV or JSON

sqtab import data.csv users

Inspect table schema

sqtab tables --schema

Run SQL queries

sqtab sql "SELECT * FROM users;"

Export a table

sqtab export users users.csv

Reset the local SQLite database

sqtab reset

For all commands:

sqtab --help

AI Features

sqtab integrates with OpenAI models to provide intelligent data assistance. You must set an API key (environment variable or .env):

OPENAI_API_KEY=your-key-here

You may also set a preferred model (optional):

SQTAB_AI_MODEL=gpt-4o-mini

If not provided, sqtab falls back to a safe default.


1. AI-Generated SQL (sql-ai)

Convert natural-language questions into valid SQLite SQL:

sqtab sql-ai "show all users older than 30"

Example result:

SELECT * FROM users WHERE age > 30;

2. AI-Assisted Table Analysis (analyze)

Analyze structure, sample rows, patterns, anomalies, and more.

Basic usage

sqtab analyze users --ai

Custom tasks & rules

sqtab analyze users --ai \
    --task "Identify anomalies" \
    --task "Suggest indexes" \
    --rule "Be concise"

Load from external files

sqtab analyze users --ai --tasks-file tasks.txt --rules-file rules.txt

Environment Variables

Variable Description Default
OPENAI_API_KEY Required for AI features
SQTAB_AI_MODEL Optional user-preferred model gpt-4o-mini

Project Status

sqtab is in active early development (0.x releases).
The core CLI is stable, but new AI features are expanding rapidly.

Feedback, ideas, and contributions are welcome.

GitHub repository:
https://github.com/gojankovic/sqtab


License

MIT License © 2025 Goran Janković

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

sqtab-0.2.0.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sqtab-0.2.0-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file sqtab-0.2.0.tar.gz.

File metadata

  • Download URL: sqtab-0.2.0.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sqtab-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f1c588d7bc000b9cfb882f782c0302041ac3ac03f0a809acb7d5ced37bd965a8
MD5 8060946d172fa0a10ce8e8e51af9b960
BLAKE2b-256 9efdeeff9de460b348f4ecb3db88419641597bc0c0afa9b647883a4f2dc6d0a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqtab-0.2.0.tar.gz:

Publisher: publish.yml on gojankovic/sqtab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sqtab-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: sqtab-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sqtab-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2e61b7c964310251e7e45b7da38da9356e691f26b8a664bf5c118226bebb97ca
MD5 85456feb8c0086a479aa93611d0248bb
BLAKE2b-256 b217479cdc6320486253393c17de81f195005feb45f871ae7a4b8e8f01455520

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqtab-0.2.0-py3-none-any.whl:

Publisher: publish.yml on gojankovic/sqtab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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