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 with evidence

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.

One of the sources publishes an evidence sentence with each question, the outside knowledge the question assumes, such as how a rate is computed from two columns. That field is carried through and is empty on the sources that do not publish one.

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 difficulty label the source publishes, otherwise "unrated". No source
                   in this pool publishes one, so every row here is "unrated"
db_id              the database the question is about
question           the natural language question
evidence           the outside knowledge the question assumes, or empty
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, with one exception. KaggleDBQA has no training split: it was published whole as an evaluation set for other systems, so all 272 of its questions are here, in the normalised layer and under raw/kaggledbqa/ with the release's own _test and _fewshot files. It is kept because it is not one of the sets this pool is checked against and because it went through the same overlap rules as every other source. Evaluation splits of the other corpora are not part of this pool.

What is in it

242225 rows in the normalised layer, over 10 sources. 233770 of them carry a query that reads and 8455 carry a statement that writes or defines a table.

Source Rows Databases Provenance Licence
BIRD, training split 6715 51 human cc-by-sa-4.0
Spider, training split 6916 166 human cc-by-sa-4.0
Spider, training split, the six earlier corpora 1659 see below human cc-by-sa-4.0
Spider-Syn, training split 6917 see below human mit (repository), cc-by-sa-4.0 for the Spider content it rewrites
SParC, training split 5973 see below human cc-by-sa-4.0
CoSQL, training split, the query-writing task 4210 see below human cc-by-sa-4.0
WikiSQL, training split 56352 1 human bsd-3-clause
KaggleDBQA 272 8 human cc-by-sa-4.0
SQL Create Context 76905 see below rule-generated cc-by-4.0
Gretel synthetic text to SQL 76306 see below model-generated apache-2.0

The sources

BIRD, training split

Directory raw/bird/, 6715 rows in rows.jsonl under the source name bird_train.

Questions written by people over 69 databases assembled from real published data, each question carrying an evidence sentence that states the outside knowledge the question assumes and a SQL query written by an expert annotator. The evidence sentence is the distinguishing feature of this corpus: many of its questions name a quantity the schema does not define, and the sentence is how it is defined.

Origin: bird-bench.github.io, the official training release archive, at revision release archive train.zip, sha256 pinned.

Format of the raw files: a JSON list, one object per question, with db_id, question, evidence and the SQL query, beside a tables file and one directory per database.

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

Attribution: BIRD (Li et al., NeurIPS 2023), bird-bench.github.io

Spider, training split

Directory raw/spider/, 6916 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/, 1659 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/, 6917 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.

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/, 5973 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/, 4210 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/, 56352 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, beside the BIRD databases, the one whose schemas 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/, 76905 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/, 76306 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 BIRD training split sit under raw/bird/train_databases/, one directory per database. The databases of the Spider family sit under raw/spider/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.

18 database(s) of the BIRD training split were left out because the published file is over 120 MB, and the 2339 questions asked over them were left out with them, so that every row in this pool can be executed against a file that ships here. They are airline, authors, bike_share_1, codebase_comments, coinmarketcap, donor, food_inspection_2, image_and_language, language_corpus, menu, movie_platform, music_platform_2, retails, sales, sales_in_weather, software_company, talkingdata, world_development_indicators.

Overlap

Every row was checked against a set of held-out questions before it was written here, and a row that matched one was dropped. Four rules: a row asked over one of the held-out databases, a question sharing a word 8-gram with a held-out question, a question of fewer than 8 words matching one outright, and a question of 6 words or more appearing word for word inside one. What each rule removed, per source, is in the manifest that travels with this pool.

The rules read the question and the database it is asked over. They do not read the evidence sentence, the outside knowledge that one of these sources publishes beside its questions. Re-run over the 242225 rows that were written, the four rules catch 0. Pointed at the evidence sentence instead, they catch 85 of the 6189 rows that carry one (77 by the 8-gram rule, 2 as a short exact match, 6 by containment). Those are annotation idioms and not questions. The same source writes "full name refers to first_name, last_name" over hundreds of unrelated questions on unrelated databases, so what that count measures is a shared way of writing a note, and the rows it names are asked over databases that are not held out.

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. Six of the ten sources are 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
463