File size: 2,993 Bytes
8e874f5
 
f31e124
 
8e874f5
 
 
 
 
 
f31e124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8e874f5
 
f31e124
8e874f5
f31e124
 
 
 
87fc202
f31e124
8e874f5
 
 
 
 
f31e124
8e874f5
 
 
 
f31e124
8e874f5
 
 
 
 
 
 
 
f31e124
8e874f5
 
 
 
 
 
 
 
f31e124
8e874f5
 
 
 
 
f31e124
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
# 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/`.