Upload 14 files
Browse files- .gitattributes +11 -0
- bird/data_clean.py +58 -0
- bird/dev/database/california_schools.sqlite +3 -0
- bird/dev/database/card_games.sqlite +3 -0
- bird/dev/database/codebase_community.sqlite +3 -0
- bird/dev/database/debit_card_specializing.sqlite +3 -0
- bird/dev/database/european_football_2.sqlite +3 -0
- bird/dev/database/financial.sqlite +3 -0
- bird/dev/database/formula_1.sqlite +3 -0
- bird/dev/database/student_club.sqlite +3 -0
- bird/dev/database/superhero.sqlite +3 -0
- bird/dev/database/thrombosis_prediction.sqlite +3 -0
- bird/dev/database/toxicology.sqlite +3 -0
- bird/dev/dataset.json +0 -0
- bird/dev/schema.json +0 -0
.gitattributes
CHANGED
|
@@ -73,3 +73,14 @@ spider/database/soccer_1.sqlite filter=lfs diff=lfs merge=lfs -text
|
|
| 73 |
spider/database/store_1.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 74 |
spider/database/world_1.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 75 |
spider/database/wta_1.sqlite filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
spider/database/store_1.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 74 |
spider/database/world_1.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 75 |
spider/database/wta_1.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 76 |
+
bird/dev/database/california_schools.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 77 |
+
bird/dev/database/card_games.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 78 |
+
bird/dev/database/codebase_community.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 79 |
+
bird/dev/database/debit_card_specializing.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 80 |
+
bird/dev/database/european_football_2.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 81 |
+
bird/dev/database/financial.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 82 |
+
bird/dev/database/formula_1.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 83 |
+
bird/dev/database/student_club.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 84 |
+
bird/dev/database/superhero.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 85 |
+
bird/dev/database/thrombosis_prediction.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 86 |
+
bird/dev/database/toxicology.sqlite filter=lfs diff=lfs merge=lfs -text
|
bird/data_clean.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from core.data_manage import load_dataset, save_dataset
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
import shutil
|
| 4 |
+
import os
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def pre():
|
| 8 |
+
base_dir = r"F:\benchmark\bird\dev"
|
| 9 |
+
save_dir = r"D:\ScientificResearch\Text2Sql\QueryFlow\benchmarks\bird\dev"
|
| 10 |
+
|
| 11 |
+
table_data = load_dataset(rf"{base_dir}\dev_tables.json")
|
| 12 |
+
|
| 13 |
+
db_info = []
|
| 14 |
+
for row in table_data:
|
| 15 |
+
db_size = len(row['column_names_original']) - 1
|
| 16 |
+
row['db_size'] = db_size
|
| 17 |
+
row['db_type'] = "sqlite"
|
| 18 |
+
db_info.append({
|
| 19 |
+
"db_id": row['db_id'],
|
| 20 |
+
"count": db_size
|
| 21 |
+
})
|
| 22 |
+
|
| 23 |
+
save_dataset(table_data, new_data_source=rf"{save_dir}\schema.json")
|
| 24 |
+
|
| 25 |
+
dataset = load_dataset(rf"{base_dir}\dev.json")
|
| 26 |
+
|
| 27 |
+
temp_dataset = []
|
| 28 |
+
for row in dataset:
|
| 29 |
+
try:
|
| 30 |
+
data_ = {
|
| 31 |
+
"instance_id": row['question_id'],
|
| 32 |
+
"db_id": row['db_id'],
|
| 33 |
+
"question": row['question'],
|
| 34 |
+
"db_type": "sqlite",
|
| 35 |
+
"db_size": [db_['count'] for db_ in db_info if db_["db_id"] == row['db_id']][0],
|
| 36 |
+
"query": row["SQL"],
|
| 37 |
+
"evidence": row["evidence"],
|
| 38 |
+
"difficulty": row["difficulty"]
|
| 39 |
+
}
|
| 40 |
+
temp_dataset.append(data_)
|
| 41 |
+
except Exception as e:
|
| 42 |
+
print(f"第 {row['instance_id']} 个样本保存出错,错误信息为:{e}")
|
| 43 |
+
|
| 44 |
+
save_dataset(temp_dataset, new_data_source=rf"{save_dir}\dataset.json")
|
| 45 |
+
|
| 46 |
+
database_dir = Path(base_dir) / "dev_databases"
|
| 47 |
+
db_id_lis = [f.name for f in database_dir.iterdir() if f.is_dir()]
|
| 48 |
+
save_dir = Path(save_dir) / "database"
|
| 49 |
+
save_dir.mkdir(exist_ok=True)
|
| 50 |
+
for db_id in db_id_lis:
|
| 51 |
+
old_path = database_dir / db_id / f"{db_id}.sqlite"
|
| 52 |
+
dst_path = os.path.join(str(save_dir), old_path.name)
|
| 53 |
+
# 移动文件
|
| 54 |
+
shutil.move(str(old_path), dst_path)
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
if __name__ == "__main__":
|
| 58 |
+
pre()
|
bird/dev/database/california_schools.sqlite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:986817d793479801ed55133e55aa27e335422c0cd3866b54a3d6317b7c5f09c1
|
| 3 |
+
size 11116544
|
bird/dev/database/card_games.sqlite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c98bdb57fe7474da798b407785544b9af0daaad5d61fd21e2a73309493bc1227
|
| 3 |
+
size 261820416
|
bird/dev/database/codebase_community.sqlite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:92101be6d2a9f6adceea59d38f6d1c556087f9eea1432432a21268cb1348036d
|
| 3 |
+
size 481419264
|
bird/dev/database/debit_card_specializing.sqlite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b3d149ad05746dbbe5116e229e17e18f09c39db43cf117d9ef3441753608b691
|
| 3 |
+
size 34635776
|
bird/dev/database/european_football_2.sqlite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e4d361dbeec6591a4b315877c0c481da05c8ff5a3d389b34d6e17b6f15bee4e0
|
| 3 |
+
size 597754880
|
bird/dev/database/financial.sqlite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d15d89cdb068a202b6f2b99342af44dffc1d52545b39ceaf62efdc0ba570101e
|
| 3 |
+
size 71294976
|
bird/dev/database/formula_1.sqlite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:17185981cd747f6cdc374cb02a6096db3130e6ec2ddc582fe1686a28fb4c4c8a
|
| 3 |
+
size 22360064
|
bird/dev/database/student_club.sqlite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:eb89bcfe97eefa386a27904ec5aa15159811a7eac894ec659a36e48fa9f76b77
|
| 3 |
+
size 2641920
|
bird/dev/database/superhero.sqlite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:75e94a2c3236ee3bb2c01fb97a1c4b4c1c269bcefd4eab1d04be323d2d0825b1
|
| 3 |
+
size 237568
|
bird/dev/database/thrombosis_prediction.sqlite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e7e16d74b4731b4b8d33fdbe8c29cd5622620788ce8d1f335631f65fc7cf1db9
|
| 3 |
+
size 7327744
|
bird/dev/database/toxicology.sqlite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f5fa7f21af1ad878ff8fef1b0582b8cb2d7ed63dbac65ff16d2ba05667650c5b
|
| 3 |
+
size 2678784
|
bird/dev/dataset.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
bird/dev/schema.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|