spider_sql_complete / README.md
EuricoGVP's picture
Upload README.md with huggingface_hub
b5a1b94 verified
|
Raw History Blame Contribute Delete
5.58 kB
metadata
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 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.

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

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.

@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}
}