mohamed-ahmed-58059/wikisql-text2sql
WikiSQL Text-to-SQL (execution-ready) A cleaned, execution-ready repackaging of WikiSQL for text-to-SQL fine-tuning and execution-accuracy evaluation. Each example pairs a natural-language question with a gold SQL query over a single-table schema — and every split ships a real SQLite database so predicted SQL can be run and compared by result set (not string-matched). Splits Split Examples train 55,339 dev 8,263 test 15,519 Columns… See the full description on the dataset page: https://huggingface.co/datasets/mohamed-ahmed-58059/wikisql-text2sql.
WikiSQL Text-to-SQL (execution-ready)
A cleaned, execution-ready repackaging of WikiSQL for text-to-SQL fine-tuning and execution-accuracy evaluation. Each example pairs a natural-language question with a gold SQL query over a single-table schema — and every split ships a real SQLite database so predicted SQL can be run and compared by result set (not string-matched).
Splits
Columns
Databases (for execution accuracy)
Each split has a SQLite DB at `dbs/{split}.db` with real table/column names, so both gold and predicted real-name SQL execute directly. Text columns are COLLATE U_NOCASE (Unicode-aware, casefold) and numeric columns are REAL.
⚠️ You must register the `U_NOCASE` collation before querying, or SQLite raises no such collation sequence: U_NOCASE. It's baked into the table schema.import sqlite3
from datasets import load_dataset
from huggingface_hub import hf_hub_download
REPO = "mohamed-ahmed-58059/wikisql-text2sql"
ds = load_dataset(REPO, split="dev")
db = hf_hub_download(REPO, "dbs/dev.db", repo_type="dataset")
con = sqlite3.connect(db)
con.create_collation("U_NOCASE", lambda a, b: (a.casefold() > b.casefold()) - (a.casefold() < b.casefold()))
ex = ds[0]
print(ex["question"])
print(ex["gold_sql"])
print(con.execute(ex["gold_sql"]).fetchall()) # execute the gold queryHow it was built
Derived from WikiSQL: table names made concise, columns normalized to snake_case, the WikiSQL logical forms decoded into clean real-name SQL, and a hardened SQLite DB built per split (NOCASE text, comma-stripped REAL numerics) so execution-accuracy comparison is robust to cosmetic differences. Full pipeline: github.com/mohamed-ahmed-58059/hf-ml-platform-text2sql.finetune.
Fine-tuned model
A QLoRA fine-tune of Llama-3.1-8B trained on this data reaches 0.915 execution accuracy on the dev split: Llama-3.1-8B-text2sql-wikisql.
License & attribution
Derived from WikiSQL (Salesforce), released under the BSD 3-Clause License. If you use this data, please cite the original work:
Victor Zhong, Caiming Xiong, Richard Socher. Seq2SQL: Generating Structured Queries from Natural Language using Reinforcement Learning. arXiv:1709.00103, 2017.
