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

Uploaded Python 3

File details

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

File metadata

  • Download URL: sqtab-0.2.4.tar.gz
  • Upload date:
  • Size: 18.7 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.4.tar.gz
Algorithm Hash digest
SHA256 dac76e406a93b9a3a3c6400331869924957eff15615e0c79df40e8e0bd8c5b7f
MD5 b6732eb110d0a1bbcb424f224df2a7e8
BLAKE2b-256 61e6c7240390a77e5d41efd8e0715d18579cfc1c4417e08ff446626406f8ba13

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: sqtab-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 18.7 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8d8b09f5b2e6f561e56571aca6133d9fc2afe16696558cce0441069ee1f11f87
MD5 ecb9132dabb13505571e85149e7d0449
BLAKE2b-256 2f566f0851936baf84e6428e17f013e97845fee571998ff292f83b431459cf23

See more details on using hashes here.

Provenance

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