schema_id stringlengths 13 13 | full_schema stringlengths 78 118k | schema_content stringlengths 438 10.3M | number_of_tables int64 1 350 |
|---|---|---|---|
schema_000876 | "CREATE TABLE public_addresses ( id int8 NOT NULL UNIQUE, city Varchar NOT NULL, country Varch(...TRUNCATED) | "{\"public_customers\": [{\"id\": 1, \"create_at\": \"2022-07-25 00:00:00\", \"customer_email\": \"t(...TRUNCATED) | 222 |
schema_001317 | "CREATE TABLE T_USUARIO_SUSCRIPCIONES ( id_usuario TEXT NOT NULL, suscripcion TEXT NOT NULL, f(...TRUNCATED) | "{\"T_EXPORT_DATA_LOGS\": [{\"id_exportacion\": \"EXP-10000\", \"id_usuario\": \"USR_3076\", \"tipo_(...TRUNCATED) | 201 |
schema_001517 | "CREATE TABLE TA_User ( UserID Numeric NOT NULL UNIQUE, UserName Varchar NOT NULL, Userrating (...TRUNCATED) | "{\"TA_User\": [{\"UserID\": 1, \"UserName\": \"Jo\", \"Userrating\": 3.2, \"Usergender\": \"Female\(...TRUNCATED) | 138 |
schema_003399 | "CREATE TABLE BPM_TASK_DEF ( ID BigInt NOT NULL UNIQUE, TASK_DEFINITION_KEY Varchar NOT NULL, (...TRUNCATED) | "{\"BPM_PROCESS\": [{\"ID\": 23, \"NAME\": \"Policy Acknowledgment\", \"START_TIME\": \"2020-01-06 1(...TRUNCATED) | 127 |
schema_004095 | "CREATE TABLE default_salary_employer ( id TEXT NOT NULL UNIQUE, name Text NOT NULL UNIQUE, cr(...TRUNCATED) | "{\"default_salary_department\": [{\"id\": \"DEPT-0001\", \"employer_id\": 249917, \"name\": \"Integ(...TRUNCATED) | 30 |
schema_004362 | "CREATE TABLE test_table ( id Integer NOT NULL UNIQUE, self_reference_id Integer NOT NULL, FOR(...TRUNCATED) | "{\"test_table\": [{\"id\": 1, \"self_reference_id\": 63}, {\"id\": 2, \"self_reference_id\": 1}, {\(...TRUNCATED) | 148 |
schema_005268 | "CREATE TABLE resettoken ( token longtext NOT NULL, owner Int NOT NULL, id Int NOT NULL UNIQUE(...TRUNCATED) | "{\"Project\": [{\"id\": 1, \"name\": \"Cleanup-Core-1\", \"description\": \"Maintenance of Cleanup-(...TRUNCATED) | 15 |
schema_005537 | "CREATE TABLE TwoFactors ( Id Integer NOT NULL UNIQUE, AccountId Integer NOT NULL, Secret Text(...TRUNCATED) | "{\"LoginAttempts\": [{\"Id\": 1, \"AccountId\": 17, \"Timestamp\": \"2021-02-14 20:35:48\", \"IsSuc(...TRUNCATED) | 182 |
schema_005691 | "CREATE TABLE auth_assignment ( item_name Varchar NOT NULL, user_id Int NOT NULL, created_at I(...TRUNCATED) | "{\"user_profile\": [{\"user_id\": 1, \"first_name\": \"Raeburn\", \"last_name\": \"Gamble\", \"emai(...TRUNCATED) | 192 |
schema_006321 | "CREATE TABLE projects ( id Integer NOT NULL UNIQUE, code Text NOT NULL, directory Text NOT NU(...TRUNCATED) | "{\"projects\": [{\"id\": 1, \"code\": \"HTTP-001\", \"directory\": \"/var/log/nginx/proxy-cache/htt(...TRUNCATED) | 4 |
SQaLe: schemas and databases
Project page · Questions and SQL · Trained models · Python library · Citation
This dataset holds the 9,259 populated databases of SQaLe, a large semi-synthetic text-to-SQL dataset grounded in real-world database schemas, introduced in the paper SQaLe: a large realistic dataset to empower small specialised text-to-SQL models. Each row is one database: its DDL, extended from a real schema in SchemaPile, and the generated rows of its tables. The databases are large, with a median of 113 tables and 538 columns, and together they hold 1,103,669 tables, 1,196,078 foreign-key relations and 108,708,694 rows.
SQaLe is split across two datasets that join on schema_id:
| Dataset | Contents | Rows |
|---|---|---|
trl-lab/SQaLe-2-text-to-SQL-Queries |
questions in eight phrasings, gold SQL, difficulty, the gold query's result | 177,377 |
trl-lab/SQaLe-2-text-to-SQL-Schemas (this dataset) |
the DDL and generated table rows of each database | 9,259 |
Quickstart
The SQaLe Python library (source on GitHub) writes these databases as SQLite files:
pip install "SQaLe>=0.2"
sqale-extract --split test --output ./dbs # all 423 test databases
sqale-extract --split train --output ./dbs --limit 100 # the first 100 training databases
sqale-extract --split test --output ./dbs --schema-id schema_012721 # one database
From Python, deserialize_sqale does the same and reports what it wrote, and build_database builds a single row of this dataset, in memory or as a file:
from datasets import load_dataset
from sqale import build_database, deserialize_sqale
for db in deserialize_sqale(split="test", output_dir="./dbs", limit=10):
print(db["schema_id"], len(db["tables"]), "tables,", sum(db["rows_per_table"].values()), "rows")
schemas = load_dataset("trl-lab/SQaLe-2-text-to-SQL-Schemas", split="test")
conn = build_database(schemas[0])
On the test split the library creates 99.7% of the tables in the DDL, including every populated table, and writes a database in about 30 ms. Re-running the 8,100 test queries on these databases reproduces their stored results for 99.8% of them, counting floating-point rounding as a match. The library downloads the split's parquet shards one at a time into the Hugging Face cache, so a run that stops early downloads only the shards it reaches. The files it writes are plain SQLite databases that can be opened read-only. Its load_questions function reads the matching questions from trl-lab/SQaLe-2-text-to-SQL-Queries.
The model repositories in the SQaLe collection include sqale_agent.py, which runs a trained text-to-SQL agent on a database written this way:
python sqale_agent.py --model trl-lab/qwen3.5-2b-grpo-sqale --db ./dbs/schema_012721.db \
--question "For each planet that has had a 'Trading Halt' alert, list the planet ID, the alert ID, and the total number of historical events recorded for that planet."
The generation pipeline. This dataset is the output of steps 1 and 2: schema extension and table value synthesis. Figure from the paper.
At a glance
| Databases | 9,259 (8,836 train / 423 test) |
| Tables | 1,103,669, a median of 113 per schema |
| Columns | a median of 538 per schema |
| Foreign-key relations | 1,196,078 |
| Generated rows | 108,708,694, a median of 69 per table |
| Tables populated | 95.2% |
| Valid foreign-key cells, after repair | 95.1% |
Foreign-key columns with a non-trivial GROUP BY |
80.0% |
A GROUP BY counts as non-trivial when at least three of its groups span more than one row.
How SQaLe compares
| Metric | BIRD | EHRSQL | SynSQL | SQaLe |
|---|---|---|---|---|
| Schemas | 80 | 2 | 16,575 | 9,259 |
| Median columns per schema | 39 | 92 | 72 | 538 |
| Median tables per schema | 5.0 | 13.5 | 10.0 | 113 |
| Foreign keys | 526 | 34 | 159,547 | 1,196,078 |
| Median rows per table | 3,738 | – | 2 | 69 |
SQaLe's schemas are an order of magnitude larger than those of any compared corpus, with a median of 538 columns against under 200 for BIRD, EHRSQL, Spider 2.0 and SynSQL. Larger schemas drawn from real DDL carry more foreign keys, so tables are less often isolated and fewer schemas admit only single-table questions. The tables are populated far more densely than SynSQL's, so questions can depend on values that have to be looked up. They hold fewer rows than the real database dumps behind BIRD.
How the databases were made
Schema collection and extension. SchemaPile records the source repository of each schema but not the domain of the application behind it. A tool-using LLM agent therefore annotates each of the 14,597 source repositories with a short domain description, released as trl-lab/schemapile_annotated. Each schema is then extended with LLM-generated tables that keep its naming conventions, level of normalisation and foreign-key style.
Generation order. Each schema is parsed into a directed foreign-key graph and decomposed into strongly connected components, which are filled in topological order, so every table is generated after the tables it references. Inside a cycle, references within the cycle are left out during generation and repaired afterwards with valid parent keys.
One Python function per table. For each table, an LLM receives the table's DDL with a column summary, up to five neighbouring tables, up to five of its original SchemaPile rows and the schema's domain description. The domain description is a hard constraint on the vocabulary of free-text and categorical values. The allowed values of every foreign key are injected into the execution environment as a Python list. The model returns a function that builds the table as a pandas DataFrame, so a large fact table costs no more to generate than a small lookup table.
Row budgets and foreign-key skew. A table with foreign keys into two or more tables is treated as a fact or junction table and receives 200–400 rows. Every other table is a lookup table with 20–100 rows. Fact tables reuse a small subset of parent keys across many rows. Over all 929,083 foreign-key columns, the most-used fifth of parent keys holds a median of 66.9% of a fact table's rows, against 34.2% under uniform sampling. This skew keeps aggregations over the data non-trivial.
Validation and repair. Each function runs in an isolated subprocess under a time limit. Duplicate primary keys are removed, and foreign-key values that do not resolve are replaced by valid parent keys. If execution fails or violations persist, the error goes back to the model, which regenerates the function, up to three attempts per table. Tables that exhaust their attempts stay empty, as do 2,885 tables in 123 schemas whose DDL the filler could not parse, which leaves 4.8% of all tables empty.
Repository annotation uses Qwen/Qwen3.5-9B, and table value synthesis uses Qwen/Qwen3.6-35B-A3B-FP8 served with vLLM. 16 near-duplicate schemas, whose DDL identifiers are at least 90% identical to those of a kept schema, are excluded from the release.
Fields
| Column | Type | Content |
|---|---|---|
schema_id |
string | join key into trl-lab/SQaLe-2-text-to-SQL-Queries |
full_schema |
string | the DDL: every CREATE TABLE statement of the database in one string |
schema_content |
string | JSON object mapping each populated table to a list of row objects ({"column": value, ...}); unpopulated tables are absent |
number_of_tables |
int | number of CREATE TABLE statements in full_schema |
Splits
The split is made at the schema level, with 95% of schemas in train and 5% in test, so no test schema appears in training: 8,836 train and 423 test schemas. The questions in trl-lab/SQaLe-2-text-to-SQL-Queries follow the same split. The train split is about 4 GB in 16 parquet shards and test about 180 MB.
Intended uses
- Executable environments for training text-to-SQL models with execution-based rewards, and for evaluating agents that have to explore a large database.
- Research on schema linking and table retrieval at the scale of real application databases.
- A source of realistic, populated relational databases for other work on structured data.
Known issues
- Semi-synthetic values. Table rows are generated by an LLM, not collected. Tables hold a median of 69 rows, which is far more than SynSQL's but fewer than the real database dumps behind BIRD. The paper names this as the corpus's clearest current limitation.
- Empty and unbuildable tables. 4.8% of tables have no rows. A few DDL statements are not valid SQLite, and on the test split 0.3% of tables cannot be created in SQLite. None of them has rows.
- SQLite only. The DDL is written for SQLite and builds there. Other engines need translation.
Citation
If you use SQaLe, please cite:
@misc{wolff2026sqale,
title = {{SQaLe}: A Large Realistic Dataset to Empower Small Specialised Text-to-{SQL} Models},
author = {Wolff, Cornelius and Gomm, Daniel and Hulsebos, Madelon},
year = {2026}
}
Authors: Cornelius Wolff and Daniel Gomm (University of Amsterdam, Centrum Wiskunde & Informatica), Madelon Hulsebos (Centrum Wiskunde & Informatica). Questions and feedback are welcome in the Community tab of this repository.
SQaLe builds on SchemaPile, and its comparisons use BIRD, EHRSQL, Spider 2.0 and SynSQL-2.5M. We thank their authors for making them available.
- Downloads last month
- 240