A curated text-to-SQL dataset for enterprise data warehouse queries.
dataset.json- 119 text-to-SQL examples with questions, SQL queries, table mappings, and join keystest-train-split.json- Pre-defined train/test split (62 train, 57 test samples)tables.json- Schema definitions for all 97 tables (columns, types, primary/foreign keys)join_keys.json- All valid foreign key relationships between tablesschema_preview.txt- Human-readable schema with sample rows and value ranges
The MySQL database dump is available in the Releases section.
Download: new_dw_indexed.sql.zip (245 MB compressed, 2.33 GB uncompressed)
This is an institutional data warehouse with tables covering:
- Facilities:
FCLT_BUILDING,FCLT_ROOMS,FCLT_FLOOR,FAC_BUILDING,FAC_ROOMS - Organization:
FCLT_ORGANIZATION,FAC_ORGANIZATION,SIS_DEPARTMENT,MASTER_DEPT_HIERARCHY - Academic:
ACADEMIC_TERMS,SIS_COURSE_DESCRIPTION,IAP_SUBJECT_* - Personnel:
HR_FACULTY_ROSTER,EMPLOYEE_DIRECTORY - Resources:
SPACE_UNIT,LIBRARY_*,TIP_* - Time:
TIME_DAYfor temporal joins
brew install mysql
brew services start mysqlConnect as root (no password by default):
mysql -u rootCreate your user and grant privileges:
CREATE USER '<username>'@'localhost' IDENTIFIED BY '<password>';
GRANT ALL PRIVILEGES ON *.* TO '<username>'@'localhost';
FLUSH PRIVILEGES;
exitDownload new_dw_indexed.sql.zip from the Releases page, then:
# Unzip
unzip new_dw_indexed.sql.zip
# Import (will prompt for password)
mysql -u <username> -p < new_dw_indexed.sqlImporting takes a few minutes due to the database size.
mysql -u <username> -p -e "USE dw; SHOW TABLES;" | head -20import mysql.connector
conn = mysql.connector.connect(
host="localhost",
user="<username>",
password="<password>",
database="dw"
)
cursor = conn.cursor()
cursor.execute("SELECT COUNT(*) FROM BUILDINGS")
print(cursor.fetchone())Or use environment variables:
export MYSQL_USER=<username>
export MYSQL_PASSWORD=<password>
export MYSQL_HOST=localhost
export MYSQL_DATABASE=dwContains detailed schema for all 97 tables. Each entry includes:
{
"dw#sep#BUILDINGS": {
"db_id": "dw",
"table_name_original": "BUILDINGS",
"column_names_original": ["BUILDING_KEY", "BUILDING_NAME", ...],
"column_types": ["varchar NOT NULL", "varchar DEFAULT NULL", ...],
"primary_key": ["BUILDING_KEY"],
"foreign_key": []
}
}List of all valid join relationships between tables:
[
["FCLT_ROOMS.FCLT_BUILDING_KEY", "FCLT_BUILDING_ADDRESS.FCLT_BUILDING_KEY"],
["MASTER_DEPT_HIERARCHY.DLC_KEY", "FCLT_ORG_DLC_KEY.DLC_KEY"],
...
]Human-readable overview of each table with:
- Join relationships
- Column names and types
- Sample rows (3 per table)
============================================================
TABLE: ACADEMIC_TERMS
============================================================
JOIN RELATIONSHIPS:
TERM_CODE -> ACADEMIC_TERMS_ALL.TERM_CODE
TERM_CODE -> SUBJECT_OFFERED.TERM_CODE
...
COLUMNS:
ACADEMIC_TERMS_KEY: varchar (nullable)
TERM_CODE: varchar (nullable)
...
SAMPLE ROWS (3):
ACADEMIC_TERMS_KEY | TERM_CODE | TERM_DESCRIPTION | ...
----------------------------------------------------------------
2010JA | 2010JA | January Term 2009-2010 | ...
Each entry in dataset.json contains:
| Field | Description |
|---|---|
question |
Natural language question |
db_id |
Database identifier |
sql |
Gold SQL query (MySQL syntax) |
gold_tables |
Tables used in the query |
mapping |
Entity-to-column mappings |
join_keys |
Foreign key relationships used |
sample_id |
Unique sample identifier |
{
"question": "What is the current building key, building street address, city, state, and postal code of the history department?",
"db_id": "dw",
"sql": "SELECT DISTINCT d.FCLT_BUILDING_KEY, e.BUILDING_STREET_ADDRESS, d.CITY, d.STATE, d.POSTAL_CODE FROM FCLT_BUILDING_ADDRESS d JOIN FCLT_ROOMS a ON a.FCLT_BUILDING_KEY = d.FCLT_BUILDING_KEY ...",
"gold_tables": ["dw#sep#FCLT_BUILDING_ADDRESS", "dw#sep#FCLT_ROOMS", ...],
"mapping": {
"building key": ["FCLT_BUILDING_ADDRESS.FCLT_BUILDING_KEY"],
"city": ["FCLT_BUILDING_ADDRESS.CITY"],
...
},
"join_keys": [
["FCLT_BUILDING_ADDRESS.FCLT_BUILDING_KEY", "FCLT_ROOMS.FCLT_BUILDING_KEY"],
...
],
"sample_id": 0
}import json
# Load dataset
with open('dataset.json') as f:
data = json.load(f)
# Load train/test split
with open('test-train-split.json') as f:
split = json.load(f)
train_samples = [data[i] for i in split['train']]
test_samples = [data[i] for i in split['test']]
print(f"Train: {len(train_samples)}, Test: {len(test_samples)}")