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.3.tar.gz (18.6 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.3-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sqtab-0.2.3.tar.gz
  • Upload date:
  • Size: 18.6 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.3.tar.gz
Algorithm Hash digest
SHA256 839bc020b9bdc748a41772b7d36d9103980a530a172801f7eded443cc581b99a
MD5 75ee58cf86967e20dbccfce641091ce8
BLAKE2b-256 f497c32ba336c1bbe641cf8102e22a029e24abd32f3897e9d0c144543fcf72b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqtab-0.2.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: sqtab-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 18.5 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8528e6124a0a70e1e8222c603a604fd664f0a3ca659a4175f23cbef55cbbd80e
MD5 1e327e339c069f3061d107f598ef8dfb
BLAKE2b-256 ff3ddeb554c04a2f4464f7cd8e6a927200dcdd9904e1ad38f8799c6f4047b861

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqtab-0.2.3-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