Datasets:
File size: 5,584 Bytes
ecf170f 89cbfc5 ecf170f 89cbfc5 ecf170f 89cbfc5 b5a1b94 ecf170f b5a1b94 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | ---
dataset_info:
- config_name: questions
features:
- name: question_id
dtype: int64
- name: source
dtype: large_string
- name: source_index
dtype: int64
- name: db_id
dtype: large_string
- name: question
dtype: large_string
- name: sql
dtype: large_string
- name: question_toks
list: string
- name: query_toks
list: string
- name: query_toks_no_value
list: string
- name: sql_parsed
dtype: large_string
splits:
- name: train
num_bytes: 10162458
num_examples: 8656
- name: validation
num_bytes: 1119256
num_examples: 1034
- name: test
num_bytes: 2405196
num_examples: 2147
download_size: 1795271
dataset_size: 13686910
- config_name: schemas
features:
- name: db_id
dtype: large_string
- name: schema_raw
dtype: large_string
- name: table_names
list: string
- name: table_names_original
list: string
- name: column_names
dtype: large_string
- name: column_names_original
dtype: large_string
- name: column_types
list: string
- name: primary_keys
dtype: large_string
- name: foreign_keys
dtype: large_string
splits:
- name: train
num_bytes: 431715
num_examples: 146
- name: validation
num_bytes: 44820
num_examples: 20
- name: test
num_bytes: 88833
num_examples: 40
download_size: 229552
dataset_size: 565368
configs:
- config_name: questions
data_files:
- split: train
path: questions/train-*
- split: validation
path: questions/validation-*
- split: test
path: questions/test-*
- config_name: schemas
data_files:
- split: train
path: schemas/train-*
- split: validation
path: schemas/validation-*
- split: test
path: schemas/test-*
language:
- en
license: cc-by-sa-4.0
size_categories:
- 10K<n<100K
task_categories:
- text-generation
pretty_name: Spider (complete)
tags:
- text-to-sql
- spider
- sqlite
---
# Spider (complete)
The [Spider](https://yale-lily.github.io/spider) text-to-SQL dataset with its questions, the DDL and metadata of every
database, and the SQLite files, in the same layout as
[birdsql_complete_devset](https://huggingface.co/datasets/EuricoGVP/birdsql_complete_devset).
## Splits
| Split | Questions | Databases |
| --- | --- | --- |
| `train` | 8,656 | 146 |
| `validation` | 1,034 | 20 |
| `test` | 2,147 | 40 |
No database appears in more than one split.
## Structure
**`questions`**: `question_id` (unique within the split), `source` (`spider` or `others`), `source_index` (position in
the original file), `db_id`, `question`, `sql`, `question_toks`, `query_toks`, `query_toks_no_value` and `sql_parsed`
(the original parsed query, as JSON text).
**`schemas`**: one row per database, in the split that uses it: `db_id`, `schema_raw` (DDL from `sqlite_master`) and the
original metadata `table_names`, `table_names_original`, `column_names`, `column_names_original`, `column_types`,
`primary_keys` and `foreign_keys` (nested fields as JSON text).
**`databases/<db_id>/<db_id>.sqlite`**: the SQLite file of every database.
## Usage
```python
import json
from datasets import load_dataset
repo = "EuricoGVP/spider_sql_complete"
questions = load_dataset(repo, "questions", split="train")
schemas = {row["db_id"]: row for row in load_dataset(repo, "schemas", split="train")}
row = questions[0]
print(schemas[row["db_id"]]["schema_raw"])
print(row["question"], row["sql"])
print(json.loads(row["sql_parsed"]))
```
## Changes from the original release
- `train` merges `train_spider.json` and `train_others.json`, the official training set; `dev.json` is `validation`.
- `query` is renamed to `sql`, and the parsed `sql` structure to `sql_parsed`.
- Metadata comes from `tables.json` (with the 2020 fixes for `scholar` and `formula_1`) and from `test_tables.json`
for the test-only databases.
- Only the `.sqlite` files are included, taken from `test_database`, which holds all 206 databases.
- Queries that do not compile in SQLite were removed:
| Split | Source | Source index | Database |
| --- | --- | --- | --- |
| `train` | spider | 3153 | `assets_maintenance` |
| `train` | spider | 4513 | `document_management` |
| `train` | spider | 4514 | `document_management` |
## Notes
- `schema_raw` is the DDL exactly as stored in each database, with inconsistent quoting and formatting.
- The `formula_1` database in `train` shares its domain and tables with the `formula_1` database of the BIRD dev set.
Exclude it when training models that are evaluated on BIRD.
## License and citation
Spider is released under CC BY-SA 4.0. Please cite Spider and, for the `others` source, Finegan-Dollak et al. (2018),
together with the original datasets listed in the Spider README.
```bibtex
@inproceedings{yu2018spider,
title = {Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Task},
author = {Tao Yu and Rui Zhang and Kai Yang and Michihiro Yasunaga and Dongxu Wang and Zifan Li and James Ma and Irene Li and Qingning Yao and Shanelle Roman and Zilin Zhang and Dragomir Radev},
booktitle = {EMNLP},
year = {2018}
}
@inproceedings{finegan-dollak2018improving,
title = {Improving Text-to-SQL Evaluation Methodology},
author = {Catherine Finegan-Dollak and Jonathan K. Kummerfeld and Li Zhang and Karthik Ramanathan and Sesh Sadasivam and Rui Zhang and Dragomir Radev},
booktitle = {Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics},
pages = {351--360},
year = {2018}
}
```
|