You need to agree to share your contact information to access this dataset

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

This dataset is released under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 licence (CC BY-NC-SA 4.0): research, academic, personal and other non-commercial use is permitted with attribution; adaptations must be shared under the same licence; commercial use is not permitted. The original public source data remains under the Government Open Data License - India (GODL-India). Commercial use: contact surya@judicialmind.ai or hello@judicialmind.ai.

Log in or Sign Up to review the conditions and access this dataset content.

BharatSQL-Data

Licence: CC BY-NC-SA 4.0 — research and non-commercial use only; derivatives must be shared under the same licence. Commercial use: contact surya@judicialmind.ai or hello@judicialmind.ai

Access is approved automatically when the email you enter matches your Hugging Face account email and belongs to the organisation you name; other requests are reviewed manually.

262,538 execution-checked text-to-SQL pairs (DuckDB) over tables from India's open government data (data.gov.in and NITI Aayog NDAP), with questions in English, Hindi and Hinglish. Every pair passed these checks: the SQL is a single read-only SELECT, it runs within 5 s, it returns a non-empty result, an independently written second SQL returns the same result, and multi-step questions are not answered by one copied cell. The test split is a benchmark on unseen ministries and unseen table layouts; the repository ships the test and validation tables and an evaluate.py harness that reproduces the execution-accuracy numbers below.

Headline result: BharatSQL-4B, trained on the train split, reaches 91.3% execution accuracy on the test split, ahead of Qwen3.8-27B-FP8 (83.9%) and Qwen3-4B-Instruct-2507 (74.6%).

Quickstart

import re
import duckdb
import pandas as pd
import pyarrow.parquet as pq
from huggingface_hub import snapshot_download

root = snapshot_download("judicialmind/BharatSQL-Data", repo_type="dataset")  # accept the terms on the Hub first
test = pd.read_parquet(f"{root}/data/test.parquet")
ex = test.iloc[0]

con = duckdb.connect()
for rid in ex.tables:  # resource ids -> view names used in schema_ddl and sql
    con.register("t_" + re.sub(r"[^0-9a-z_]", "_", rid.lower()), pq.read_table(f"{root}/tables/{rid}.parquet"))
print(ex.question)
print(ex.sql)
print(con.execute(ex.sql).fetchall())

Output: the question

List the top 3 financial years for India based on the highest value of the secondary indicator (I7798_6) for the Domestic Product category.

its gold SQL

SELECT "Year", "I7798_6" FROM t_ndap_7798 WHERE "Country" = 'India' AND "D7798_3" = 'Domestic Product' ORDER BY "I7798_6" DESC LIMIT 3

and the result:

Gold query result

Year I7798_6
Financial Year (Apr - Mar), 2023 17,650,590.95
Financial Year (Apr - Mar), 2022 16,164,913.38
Financial Year (Apr - Mar), 2023 16,151,476.51

With the datasets library: load_dataset("judicialmind/BharatSQL-Data", split="test") (splits train, validation, test).

Evaluate a model

  1. For every test item, prompt the model with schema_ddl and question. evaluate.build_messages(schema_ddl, question) gives the chat messages BharatSQL-4B uses (system prompt + Tables:\n<schema_ddl>\n\nQuestion: <question>); any prompt is allowed.
  2. Save one row per item with id and pred_sql (or the raw reply as response; the SQL is taken from the first ```sql block) as .parquet, .jsonl or .csv.
  3. Score:
pip install -r requirements.txt
python evaluate.py --predictions my_predictions.jsonl            # test split; --split dev for validation
python evaluate.py --predictions predictions/BharatSQL-4B.parquet  # reproduces the 91.3% below

evaluate.py runs the predicted SQL and the gold SQL in a locked in-memory DuckDB connection over the item's tables and prints exec_acc (same result rows, column order ignored, numbers compared at 6 significant digits), exec_acc_loose (also accepts extra or missing label columns), exec_ok (the SQL runs) and breakdowns by held-out type, language, tier and LGD join. --out scores.jsonl writes per-item results.

Files

path contents
data/train.parquet 230,976 pairs
data/dev.parquet 2,619 pairs (validation)
data/test.parquet 28,943 pairs (benchmark)
tables/<resource id>.parquet the 4,338 tables used by the validation and test pairs
predictions/<model>.parquet test-set SQL of the models in the Results table (id, pred_sql)
evaluate.py, requirements.txt execution-accuracy harness

Schema

field type description
id string pair id
question string natural-language question
lang string en, hi (Devanagari) or hinglish (Hindi in Latin script mixed with English)
tables list[string] resource ids of the table(s) the SQL reads; ndap-<n> ids are NITI Aayog NDAP datasets
schema_ddl string DuckDB CREATE TABLE text for the table(s), with title, publisher, row count and example values per column; table names are t_<resource id> with non-alphanumerics as _
sql string gold DuckDB SELECT
result string JSON list of the gold result rows (first 20 rows)
result_hash string order-free SHA-1 of the full gold result (evaluate.result_hash)
multi_step bool the question needs several steps (ranking, ratios, comparisons, subqueries)
join_on_lgd bool the SQL joins two tables on an LGD (Local Government Directory) code column
ministry string publishing ministry / department / State
tier string lookup, aggregate or multi_step
consistency string agreement of the independent second SQL: strict (identical rows) or loose (same rows up to label columns)
split string train, dev or test
heldout string test/dev: ministry (ministry unseen in train) or template (table layout unseen in train); train: none
attribution string GODL-India attribution of the source resource (publisher, title, resource URL, snapshot)
split pairs en hi hinglish LGD joins
train 230,976 140,619 44,981 45,376 439
dev 2,619 1,608 493 518 9
test 28,943 17,876 5,372 5,695 462

Tiers (all splits): lookup 84,708, aggregate 85,759, multi_step 92,071.

Results

Test split (28,943 questions, n = 28,943 for every row). Test questions come from 61 held-out ministries and from held-out table templates: no ministry or table layout in test appears in train.

model exec acc SQL runs
BharatSQL-4B 91.3% 99.8%
Qwen3.8-27B-FP8 (zero-shot) 83.9% 99.7%
Qwen3-4B-Instruct-2507 (zero-shot) 74.6% 97.2%

Exec acc by tier, language and held-out type:

model aggregate (9,821) multi_step (10,204) en (17,876) hi (5,372) hinglish (5,695) unseen ministry (18,799) unseen template (10,144) LGD join (462)
BharatSQL-4B 92.7% 86.1% 91.4% 91.5% 91.1% 90.6% 92.7% 42.6%
Qwen3.8-27B-FP8 (zero-shot) 87.1% 69.9% 84.6% 81.4% 84.4% 84.4% 83.2% 41.6%
Qwen3-4B-Instruct-2507 (zero-shot) 80.1% 58.0% 76.4% 72.2% 71.2% 73.6% 76.5% 16.7%

python evaluate.py --predictions predictions/<model>.parquet reproduces these numbers from the shipped files.

Coverage

Tables from data.gov.in (snapshot May 2026) and NITI Aayog NDAP across 113 ministries, departments and States in train and 61 further ministries in test; national, State and district tables. 262,538 pairs in total.

Source data

Derived from 33,660 resources published on the Open Government Data Platform India (data.gov.in), snapshot May 2026, under the Government Open Data License - India. Per-resource attribution (provider, title, resource URL) is in the attribution column. GODL-India does not cover personal information; tables with personal fields were excluded.

Providers: Agriculture and Farmer's welfare, Govt of Meghalaya, Andhra Pradesh, Animal Husbandry and Veterinary Department, Govt of Meghalaya, Assam, Backward class welfare, Govt of Karnataka, Commerce & Industries Department, Govt of Meghalaya, Comptroller And Auditor General of India(CAG), Comptroller and Auditor General of India, DBT Mission, Cabinet Secretariat, Delhi (NCT), Department for Promotion of industry and Internal Trade, Department for Promotion of industry and Internal Trade,Ministry of Commerce and Industry,Office of the Economic Adviser, Department of Agriculture, Govt of Karnataka, Department of Animal Husbandry and Dairying, Department of Animal Husbandry, Govt of Karnataka, Department of Atomic Energy, Department of Cooperatives, Govt of Karnataka, Department of Health and Family Welfare, Department of Health and Family Welfare, Govt of Meghalaya, Department of Higher Education, Govt of Karnataka, and 160 more.

Tables with ids starting ndap- come from NITI Aayog's NDAP (ndap.niti.gov.in), not data.gov.in.

Original data: published by the ministries, departments and State governments named per table / resource in this release on the Open Government Data Platform India (data.gov.in) and, where marked, NITI Aayog's National Data and Analytics Platform (NDAP), under the Government Open Data License - India (GODL-India). The original public data remains under GODL-India; the CC BY-NC-SA 4.0 licence of this repository covers JudicialMind's compilation, derived fields, annotations, benchmarks and models.

Citation

@misc{judicialmind2026bharatsqldata,
  title={BharatSQL-Data: Execution-checked text-to-SQL over Indian open government data},
  author={JudicialMind},
  year={2026},
  publisher={Hugging Face},
  howpublished={\url{https://huggingface.co/datasets/judicialmind/BharatSQL-Data}}
}

License

CC BY-NC-SA 4.0 (see LICENSE): research, academic, personal and other non-commercial use, with attribution to JudicialMind and to the original data publishers; adaptations must be shared under the same licence. Commercial use requires a separate licence.

Commercial use: contact surya@judicialmind.ai or hello@judicialmind.ai.

Downloads last month
12

Models trained or fine-tuned on judicialmind/BharatSQL-Data

Collection including judicialmind/BharatSQL-Data