Dataset Viewer

The dataset viewer is not available because its heuristics could not detect any supported data files. You can try uploading some data files, or configuring the data files location manually.

YAML Metadata Warning:The task_categories "text2sql" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, image-text-to-image, image-text-to-video, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other

Text to SQL training pool

A training pool for text-to-SQL models, assembled from the public corpora that publish both a question and a SQL query, with the databases those queries run against. Every query here was executed against its own database when the pool was built, and the rows whose query did not run were left out, so a query in this pool is a query that works.

The pool ships in two layers over the same data. Use whichever suits the job.

rows.jsonl is the normalised layer: one JSON object per line, every source in one shape.

id                 unique within the pool, prefixed with the source it came from
source             the source directory under raw/ that this row was read from
provenance_class   human, collected, model-generated or rule-generated
revision           the commit or digest the source was pinned at
category           the Spider hardness level where the source publishes a parsed query,
                   otherwise "unrated"
db_id              the database the question is about
question           the natural language question
schema             the CREATE TABLE statements of that database, read from the database
                   itself, which is what a prompt would show
gold               the SQL query that answers the question
database           the path of the SQLite file, relative to this directory, or absent when
                   the row carries a script instead
database_script    the CREATE TABLE script that builds the row's database, on the two
                   sources that publish a schema rather than a file
order_matters      whether the query fixes the order of its rows
timeout            seconds this query needed when the pool was built, scaled to a bound

raw/ is the source layer: one directory per source, each holding the source's own files in the source's own format, so that any field the normalisation drops is still there.

A row that carries database_script instead of database builds its database in one line:

connection = sqlite3.connect(":memory:")
connection.executescript(row["database_script"])

Not every gold query reads: one of the generated sources publishes statements that insert, update, delete or define tables beside the ones that select. The count is below, and one line of Python tells them apart, since a query opens with SELECT or WITH.

Only training splits are included. Evaluation splits of these corpora are not part of this pool.

What is in it

235042 rows in the normalised layer, over 9 sources. 226587 of them carry a query that reads and 8455 carry a statement that writes or defines a table.

Source Rows Databases Provenance Licence
Spider, training split 6929 146 human cc-by-sa-4.0
Spider, training split, the six earlier corpora 1658 see below human cc-by-sa-4.0
Spider-Syn, training split 6959 see below human mit (repository), cc-by-sa-4.0 for the Spider content it rewrites
SParC, training split 6016 see below human cc-by-sa-4.0
CoSQL, training split, the query-writing task 4213 see below human cc-by-sa-4.0
WikiSQL, training split 56351 1 human bsd-3-clause
KaggleDBQA 272 8 human cc-by-sa-4.0
SQL Create Context 76362 see below rule-generated cc-by-4.0
Gretel synthetic text to SQL 76282 see below model-generated apache-2.0

The sources

Spider, training split

Directory raw/spider/, 6929 rows in rows.jsonl under the source name spider_train.

Eleven Yale students wrote the questions and the SQL queries over 200 databases, and each pair was checked by a second annotator. The training split is train_spider.json, 7000 questions over 140 databases.

Origin: yale-lily.github.io/spider, re-hosted as one archive at huggingface.co/datasets/HAL-9001/spider-databases, at revision 4a01bbac6520cd35b216db9e1724e5e1ada60aa4.

Format of the raw files: a JSON list, one object per question, with db_id, question, query and the query parsed by the release's own parser.

Provenance class: human. Licence: cc-by-sa-4.0.

Attribution: Spider (Yu et al., EMNLP 2018), yale-lily.github.io/spider

Spider, training split, the six earlier corpora

Directory raw/spider/, 1658 rows in rows.jsonl under the source name spider_train_others.

Restaurants, GeoQuery, Scholar, Academic, IMDB and Yelp, six older single-database text-to-SQL corpora that the Spider authors converted into their format and shipped with the training split. The questions and the queries are the original authors' work, human written throughout.

Origin: the same archive, train_others.json, at revision 4a01bbac6520cd35b216db9e1724e5e1ada60aa4.

Format of the raw files: the same JSON list format as train_spider.json.

Provenance class: human. Licence: cc-by-sa-4.0.

Attribution: Spider (Yu et al., EMNLP 2018) and the six original corpora cited in its README

Spider-Syn, training split

Directory raw/spider_syn/, 6959 rows in rows.jsonl under the source name spider_syn.

The Spider training questions with schema words replaced by human-chosen synonyms, so that a question no longer names the columns it needs. The substitutions were made by the paper's authors by hand. The queries are Spider's, unchanged. Only the training split is here: the evaluation split of Spider-Syn rewrites questions of the Spider development split and is not part of this pool.

Origin: github.com/ygan/Spider-Syn, Spider-Syn/train_spider.json, at revision 0b996a57b7e329c14c300a8fb13661da128a9ddc.

Format of the raw files: a JSON list with db_id, query, the original SpiderQuestion and the rewritten SpiderSynQuestion.

Provenance class: human. Licence: mit (repository), cc-by-sa-4.0 for the Spider content it rewrites.

Attribution: Spider-Syn (Gan et al., ACL 2021), github.com/ygan/Spider-Syn

SParC, training split

Directory raw/sparc/, 6016 rows in rows.jsonl under the source name sparc.

Question sequences over the Spider databases, written by students: a user asks a series of related questions and each one carries its own SQL query. Built on the Spider training databases, so the pool takes the first question of every sequence, which stands on its own, and the sequence's closing goal question, which the annotators wrote as a single self-contained request.

Origin: yale-lily.github.io/sparc, the official release archive, at revision google drive file 1Uu7NMHTR1tdQw1t7bAuM7OPU4LElVKfg, sha256 pinned.

Format of the raw files: a JSON list, one object per sequence, with database_id, an interaction list of turns and a final goal question with its query.

Provenance class: human. Licence: cc-by-sa-4.0.

Attribution: SParC (Yu et al., ACL 2019), yale-lily.github.io/sparc

CoSQL, training split, the query-writing task

Directory raw/cosql/, 4213 rows in rows.jsonl under the source name cosql.

Dialogues between a person asking for data and a person who writes SQL, collected by the authors over the Spider databases, with a query recorded for every user turn that asks for one. The pool takes the first user turn of each dialogue and the dialogue's stated goal, both of which stand on their own.

Origin: the official CoSQL release, sql_state_tracking/cosql_train.json, mirrored at huggingface.co/datasets/avandar2024/cosql, at revision 086e752c5cba551d66ba2750144e7ed16a887efe.

Format of the raw files: a JSON list, one object per dialogue, with database_id, an interaction list of turns and a final goal question with its query.

Provenance class: human. Licence: cc-by-sa-4.0.

Attribution: CoSQL (Yu et al., EMNLP 2019), yale-lily.github.io/cosql

WikiSQL, training split

Directory raw/wikisql/, 56351 rows in rows.jsonl under the source name wikisql.

Crowdworkers were shown a query generated from a template over one Wikipedia table and wrote a natural question for it, then a second round of workers paraphrased and verified those questions. The question is human written, the query behind it comes from a template, and every query reads a single table with at most three equality or comparison conditions.

Origin: github.com/salesforce/WikiSQL, data.tar.bz2, at revision cffb423077756d04c1bac5bcd45167c86903fbcb.

Format of the raw files: one JSON object per line with the question, the table id and the query as a structured annotation, beside a second file of the tables with their headers and rows.

Provenance class: human. Licence: bsd-3-clause.

Attribution: WikiSQL (Zhong, Xiong and Socher, 2017), github.com/salesforce/WikiSQL. The tables come from Wikipedia.

KaggleDBQA

Directory raw/kaggledbqa/, 272 rows in rows.jsonl under the source name kaggledbqa.

Eight databases published on Kaggle by their owners, kept in their original unnormalised shape, with questions written by people who were shown the database documentation rather than the schema, and the SQL written by the authors. The smallest source here and the one whose databases look most like real ones.

Origin: github.com/Chia-Hsuan-Lee/KaggleDBQA for the questions, the release's Google Drive folder for the databases, at revision ab6325c9b5749f2f3509a1f64299bfa30396e6b0.

Format of the raw files: one JSON list per database with db_id, question, query and the parsed query, beside a tables file describing the schemas.

Provenance class: human. Licence: cc-by-sa-4.0.

Attribution: KaggleDBQA (Lee, Polozov and Richardson, ACL 2021), github.com/Chia-Hsuan-Lee/KaggleDBQA. The databases carry the licences of the Kaggle datasets they come from, listed in the release's DATASETS.md.

SQL Create Context

Directory raw/sql_create_context/, 76362 rows in rows.jsonl under the source name sql_create_context.

Questions and queries taken from the training splits of WikiSQL and Spider, with a CREATE TABLE statement written for each one by a program that reads the columns the query touches. The question and the query are the original corpora's; the schema beside them is generated and holds only the columns the query uses, so the tables are narrower than real ones and carry no rows.

Origin: huggingface.co/datasets/b-mc2/sql-create-context, at revision 9d80a6a118b838d9defc3798d659a54a2ac2ff37.

Format of the raw files: a JSON list with question, context (the CREATE TABLE statements) and answer (the query).

Provenance class: rule-generated. Licence: cc-by-4.0.

Attribution: b-mc2/sql-create-context, built from WikiSQL and Spider

Gretel synthetic text to SQL

Directory raw/gretel_synthetic/, 76282 rows in rows.jsonl under the source name gretel_synthetic.

Written end to end by language models over one hundred invented business domains: the schema, the rows, the question, the query and an explanation of the query were all generated, then filtered by the publisher with a language model acting as a judge. Nothing in it was written by a person.

Origin: huggingface.co/datasets/gretelai/synthetic_text_to_sql, at revision 740ab236e64503fba51be1101df7a1be83bf455d.

Format of the raw files: a parquet table whose columns include the question, a context of CREATE TABLE and INSERT statements, the query, the domain and a complexity label.

Provenance class: model-generated. Licence: apache-2.0.

Attribution: gretelai/synthetic_text_to_sql, Apache 2.0

Databases

The databases of the Spider family sit under raw/spider/database/, one directory per database, and the questions of Spider-Syn, SParC and CoSQL are asked over those same databases rather than over copies of them. KaggleDBQA's eight databases sit under raw/kaggledbqa/databases/. WikiSQL's tables are rebuilt into one SQLite file at database/wikisql_train.sqlite, with the published header of each column as the column name and text columns declared COLLATE NOCASE, and the release's own database is kept unchanged at raw/wikisql/train.db. A database file of 100 MB or more was rewritten with VACUUM, which removes free pages without changing a row, and every query was executed against the rewritten file.

Licences

The pool as a whole is offered under cc-by-sa-4.0, the most restrictive of the licences its sources carry, and each source keeps its own licence and its own attribution as listed above. The Spider family is CC BY-SA 4.0, which is a share-alike licence, so anything built from this pool that redistributes the data carries the same terms.

Downloads last month
141