| # Text-to-SQL Data |
|
|
| This directory contains the data for the Text-to-SQL benchmark, supporting |
| [Spider2-lite](https://github.com/xlang-ai/Spider2) and [Bird](https://bird-bench.github.io/) datasets. |
|
|
| ## Structure |
|
|
| ``` |
| data/text2sql/ |
| βββ README.md |
| βββ spider2-lite/ |
| β βββ spider2-lite.jsonl # Spider2-lite questions (546 instances) |
| β βββ golden_lite_spider_total.json # Gold labels for evaluation |
| β βββ sqlite/ # Local SQLite databases |
| β β βββ <DB_Name>/ |
| β β βββ <DB_Name>.sqlite # SQLite database file |
| β β βββ <DB_Name>_db_summary.json # Auto-generated schema summary |
| β βββ bigquery/ # BigQuery dataset schemas |
| β β βββ <dataset_group>/ |
| β β βββ <dataset_group>_bigquery_summary.json |
| β βββ snowflake/ # Snowflake database schemas |
| β βββ <DATABASE>/ |
| β βββ <DATABASE>_db_summary.json |
| βββ bird/ |
| βββ bird.jsonl # Bird questions (129 instances) |
| βββ databases/ |
| βββ <DB_Name>/ |
| βββ <DB_Name>.sqlite |
| βββ <DB_Name>_db_summary.json |
| ``` |
|
|
| ## Included Example Databases |
|
|
| | Backend | Benchmark | Database | Description | |
| |-----------|-------------|------------|------------------------------| |
| | SQLite | Spider2-lite | **Pagila** | DVD rental store (16 tables) | |
| | SQLite | Bird | **superhero** | Superhero database (10 tables) | |
| | BigQuery | Spider2-lite | **san_francisco** | SF city data: bikeshare, crime, film locations, fire dept, street trees (8 tables, 118 columns, schema only) | |
| | Snowflake | Spider2-lite | AUSTIN | Austin 311 service requests (schema only) | |
| |
| ## Adding a New SQLite Database |
| |
| 1. Place the `.sqlite` file: |
| ``` |
| data/text2sql/spider2-lite/sqlite/MyDB/MyDB.sqlite |
| ``` |
| 2. The schema summary is auto-generated on first run, or generate manually: |
| ```bash |
| python -m src.indexing.extract_db_summary \ |
| --db-path data/text2sql/spider2-lite/sqlite/MyDB/MyDB.sqlite |
| ``` |
| |
| ## Adding a BigQuery Database |
| |
| 1. Generate the summary using the BigQuery extractor: |
| ```bash |
| python -m src.indexing.extract_db_summary_bigquery \ |
| --datasets project_id.dataset_id \ |
| --output-dir data/text2sql/spider2-lite/bigquery/my_dataset/ |
| ``` |
| |
| ## Adding a Snowflake Database |
| |
| 1. Generate the summary using the Snowflake extractor: |
| ```bash |
| python -m src.indexing.extract_db_summary_snowflake \ |
| --databases MY_DATABASE \ |
| --output-dir data/text2sql/spider2-lite/snowflake/MY_DATABASE/ |
| ``` |
| |
| ## Full Spider2-lite Data |
| |
| To run the full benchmark, clone [Spider2](https://github.com/xlang-ai/Spider2) |
| and copy the databases into `spider2-lite/sqlite/`. |
| |