Skip to main content

Transqlate

Transqlate is a production‑ready natural language → SQL assistant powered by a fine‑tuned Phi‑4 Mini model. It lets anyone—technical or not—create and run complex queries over SQLite, PostgreSQL, MySQL, MSSQL, or Oracle databases using plain English.


Key Features

  • Schema‑Aware NL→SQL – Automatically extracts your database schema and prunes it with an RAG pipeline so prompts fit within model limits.
  • Interactive CLI – Generate queries, explore schemas, edit or write SQL, and dynamically switch connections with :changedb (alias :change_db).
  • Safe Execution – DDL/DML statements require explicit confirmation. Lost connections trigger an optional reconnect with troubleshooting tips.
  • Chain‑of‑Thought Reasoning – View the model’s reasoning and final SQL, converted from SQLite syntax to your database dialect with automatic schema qualification.
  • Customizable Inference – Control maximum generation length (--max-new-tokens), enable Python tracebacks for debugging, and point to local or HF-hosted model weights.
  • Offline‑Friendly – Runs on CPU and can pre‑download the sentence‑transformer embedding model so future runs work without internet access.
  • Supports One‑Shot Queries – Use -q "question" for quick, non‑interactive SQL generation.

Installation

pip install transqlate

Usage

Launch the interactive CLI:

transqlate --interactive

Run a single question:

transqlate -q "List all customers who made purchases in March." --db-path path/to/database.db

REPL commands include :show schema, :history, :edit, :write, :examples, :clear, :changedb, :about, and :exit.


License

MIT License


Author

Shaurya Sethi Contact: shauryaswapansethi@gmail.com


For the full user manual and source code, visit the GitHub repository or the Hugging Face model page.


What's New in v0.1.2

  • Cross-dialect SQL post-processing: Automatically transforms model-generated (SQLite-style) SQL into the target dialect (PostgreSQL, MySQL, MSSQL, Oracle) with clear conversion notices.
  • Enhanced CLI workflow: Added :edit for modifying generated SQL, :write for manual queries, and seamless database switching with :changedb/:change_db.
  • Improved schema extraction: Robust support for PostgreSQL, Oracle, and MSSQL with qualified and escaped identifiers; Oracle system tables can now be filtered.
  • Safer execution and state management: CLI now detects and recovers from lost connections, rolls back on errors, and requires confirmation for DDL/DML.
  • History and troubleshooting: Query history now shows manual/edited status and execution results. Added :troubleshoot for step-by-step connection help.
  • Token limit control: Set output length using the --max-new-tokens argument (default: 2048).
  • Numerous bugfixes and UX refinements: Identifier quoting, error messages, startup feedback, and more.

What's New in v0.1.3

Spreadsheet Mode (CSV/Excel) Support & Enhanced Exporting

  • Spreadsheet/CSV Mode: You can now use Transqlate with your Excel (.xlsx, .xls) and CSV files! At startup, select Spreadsheet/CSV mode and provide your file path. The tool will automatically convert your spreadsheet into a temporary SQLite database, enabling you to run natural language queries just like with any database.

  • Multi-Sheet Excel Support: If your Excel file has multiple sheets, Transqlate will prompt you to choose which sheet to work with, ensuring a seamless experience across complex spreadsheets.

  • Export Results to CSV or Excel: After running your queries, use the new :export command to save results or entire tables as CSV or Excel files for easy sharing and further analysis. Example:

    :export csv "SELECT * FROM Orders WHERE Total > 1000" big_orders.csv
    :export excel Customers customers.xlsx
    
  • Improved Help and Documentation: The :help and :about commands have been revamped for clarity, providing concise guidance in the CLI and detailed usage instructions in the manual.

  • Context-Aware Commands: Command menus and help are now tailored to your current mode, making the CLI cleaner and easier to use.

Upgrade to v0.1.3 and unlock the power of natural language queries for spreadsheets, with robust export features and a streamlined user experience!


For the full release notes, see CHANGELOG.md.

Metadata

Release files for transqlate 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for transqlate 1.0.0
File Size Uploaded
transqlate-1.0.0.tar.gz 46.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for transqlate 1.0.0
File Interpreter ABI Platform
transqlate-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 87.0 kB

Release files / transqlate-1.0.0.tar.gz

Download URL transqlate-1.0.0.tar.gz
Size 46.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0483a6863d320bf5dd1f3ede2613b0e6bab23d645ec98ed9df64ef32bb4d2734
BLAKE2b-256 checksum
How to use checksums
bace047e98a1185ca52437a0d01ffc4d4ad38f4e3ca0d5b044073c5c4640b308
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.7

Release files / transqlate-1.0.0-py3-none-any.whl

Download URL transqlate-1.0.0-py3-none-any.whl
Size 40.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4314674dc420e126356ee594455e1a0d0796cabd9aef213c0999edd81a795ec0
BLAKE2b-256 checksum
How to use checksums
968f20d6260699755f0eddd2d74d3a61a439fa82e1a17058e1dbc64e6e41e569
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.7

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page