relbench 2.1.2__tar.gz → 3.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- relbench-3.0.0/PKG-INFO +194 -0
- relbench-3.0.0/README.md +154 -0
- {relbench-2.1.2 → relbench-3.0.0}/pyproject.toml +27 -19
- relbench-3.0.0/relbench/__init__.py +28 -0
- {relbench-2.1.2 → relbench-3.0.0}/relbench/base/__init__.py +4 -2
- relbench-3.0.0/relbench/base/database.py +49 -0
- relbench-3.0.0/relbench/base/dataset.py +120 -0
- relbench-3.0.0/relbench/base/table.py +89 -0
- relbench-3.0.0/relbench/base/task_autocomplete.py +197 -0
- {relbench-2.1.2 → relbench-3.0.0}/relbench/base/task_base.py +133 -42
- {relbench-2.1.2 → relbench-3.0.0}/relbench/base/task_entity.py +2 -2
- {relbench-2.1.2 → relbench-3.0.0}/relbench/base/task_recommendation.py +26 -24
- relbench-3.0.0/relbench/hf.py +171 -0
- relbench-3.0.0/relbench/load.py +604 -0
- relbench-3.0.0/relbench/manifest.py +330 -0
- relbench-3.0.0/relbench/metrics.py +72 -0
- {relbench-2.1.2 → relbench-3.0.0}/relbench/modeling/graph.py +76 -20
- {relbench-2.1.2 → relbench-3.0.0}/relbench/modeling/loader.py +3 -3
- {relbench-2.1.2 → relbench-3.0.0}/relbench/modeling/nn.py +15 -14
- {relbench-2.1.2 → relbench-3.0.0}/relbench/modeling/utils.py +1 -3
- relbench-3.0.0/relbench/schema.py +398 -0
- relbench-3.0.0/relbench/submit.py +1158 -0
- relbench-2.1.2/PKG-INFO +0 -344
- relbench-2.1.2/README.md +0 -306
- relbench-2.1.2/relbench/__init__.py +0 -1
- relbench-2.1.2/relbench/base/database.py +0 -122
- relbench-2.1.2/relbench/base/dataset.py +0 -214
- relbench-2.1.2/relbench/base/table.py +0 -157
- relbench-2.1.2/relbench/base/task_autocomplete.py +0 -214
- relbench-2.1.2/relbench/datasets/__init__.py +0 -174
- relbench-2.1.2/relbench/datasets/amazon.py +0 -228
- relbench-2.1.2/relbench/datasets/arxiv.py +0 -107
- relbench-2.1.2/relbench/datasets/avito.py +0 -134
- relbench-2.1.2/relbench/datasets/dbinfer.py +0 -124
- relbench-2.1.2/relbench/datasets/event.py +0 -183
- relbench-2.1.2/relbench/datasets/f1.py +0 -238
- relbench-2.1.2/relbench/datasets/fake.py +0 -114
- relbench-2.1.2/relbench/datasets/hashes.json +0 -38
- relbench-2.1.2/relbench/datasets/hm.py +0 -70
- relbench-2.1.2/relbench/datasets/mimic.py +0 -606
- relbench-2.1.2/relbench/datasets/ratebeer.py +0 -337
- relbench-2.1.2/relbench/datasets/salt.py +0 -163
- relbench-2.1.2/relbench/datasets/stack.py +0 -132
- relbench-2.1.2/relbench/datasets/tgb.py +0 -75
- relbench-2.1.2/relbench/datasets/trial.py +0 -369
- relbench-2.1.2/relbench/metrics.py +0 -233
- relbench-2.1.2/relbench/tasks/__init__.py +0 -596
- relbench-2.1.2/relbench/tasks/amazon.py +0 -380
- relbench-2.1.2/relbench/tasks/arxiv.py +0 -232
- relbench-2.1.2/relbench/tasks/avito.py +0 -218
- relbench-2.1.2/relbench/tasks/dbinfer.py +0 -214
- relbench-2.1.2/relbench/tasks/event.py +0 -180
- relbench-2.1.2/relbench/tasks/f1.py +0 -220
- relbench-2.1.2/relbench/tasks/hashes.json +0 -128
- relbench-2.1.2/relbench/tasks/hm.py +0 -160
- relbench-2.1.2/relbench/tasks/mimic.py +0 -77
- relbench-2.1.2/relbench/tasks/ratebeer.py +0 -469
- relbench-2.1.2/relbench/tasks/stack.py +0 -332
- relbench-2.1.2/relbench/tasks/tgb.py +0 -627
- relbench-2.1.2/relbench/tasks/trial.py +0 -268
- relbench-2.1.2/relbench/utils.py +0 -73
- {relbench-2.1.2 → relbench-3.0.0}/LICENSE +0 -0
- {relbench-2.1.2 → relbench-3.0.0}/relbench/modeling/__init__.py +0 -0
relbench-3.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: relbench
|
|
3
|
+
Version: 3.0.0
|
|
4
|
+
Summary: RelBench: Relational Deep Learning Benchmark
|
|
5
|
+
Keywords: relational deep learning,graph neural networks,relational databases,benchmark,machine learning
|
|
6
|
+
Author-email: RelBench Team <relbench@cs.stanford.edu>
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: pandas
|
|
17
|
+
Requires-Dist: huggingface_hub
|
|
18
|
+
Requires-Dist: pyyaml
|
|
19
|
+
Requires-Dist: pyarrow
|
|
20
|
+
Requires-Dist: numpy
|
|
21
|
+
Requires-Dist: duckdb
|
|
22
|
+
Requires-Dist: scikit-learn
|
|
23
|
+
Requires-Dist: typing-extensions
|
|
24
|
+
Requires-Dist: tqdm
|
|
25
|
+
Requires-Dist: pytest ; extra == "dev"
|
|
26
|
+
Requires-Dist: pre-commit ; extra == "dev"
|
|
27
|
+
Requires-Dist: sentence-transformers ; extra == "example"
|
|
28
|
+
Requires-Dist: pytorch_frame[full] ; extra == "example"
|
|
29
|
+
Requires-Dist: torch_geometric ; extra == "example"
|
|
30
|
+
Requires-Dist: tqdm ; extra == "example"
|
|
31
|
+
Requires-Dist: graphviz ; extra == "schema"
|
|
32
|
+
Project-URL: Data, https://huggingface.co/stanford-star
|
|
33
|
+
Project-URL: Home, https://star-project.stanford.edu/relbench
|
|
34
|
+
Project-URL: Issues, https://github.com/stanford-star/relbench/issues
|
|
35
|
+
Project-URL: Repository, https://github.com/stanford-star/relbench
|
|
36
|
+
Provides-Extra: dev
|
|
37
|
+
Provides-Extra: example
|
|
38
|
+
Provides-Extra: schema
|
|
39
|
+
|
|
40
|
+
<p align="center"><img src="https://star-project.stanford.edu/assets/img/relbench/logo.png" alt="RelBench" width="600px" /></p>
|
|
41
|
+
|
|
42
|
+
<p align="center">
|
|
43
|
+
<a href="https://star-project.stanford.edu/relbench"><img src="https://img.shields.io/badge/website-STAR%20Project-3f9e78.svg" alt="Website: STAR Project" /></a>
|
|
44
|
+
<a href="https://huggingface.co/stanford-star"><img src="https://img.shields.io/badge/data-%F0%9F%A4%97%20Hugging%20Face-ffcc00.svg" alt="Data: Hugging Face" /></a>
|
|
45
|
+
<a href="https://pypi.org/project/relbench/"><img src="https://img.shields.io/pypi/v/relbench?color=3f9e78" alt="PyPI" /></a>
|
|
46
|
+
<a href="https://github.com/stanford-star/relbench/actions/workflows/testing.yml"><img src="https://github.com/stanford-star/relbench/actions/workflows/testing.yml/badge.svg" alt="Tests" /></a>
|
|
47
|
+
<a href="https://arxiv.org/abs/2407.20060"><img src="https://img.shields.io/badge/arXiv-2407.20060%20(RelBench)-b31b1b.svg" alt="arXiv: RelBench" /></a>
|
|
48
|
+
<a href="https://arxiv.org/abs/2602.12606"><img src="https://img.shields.io/badge/arXiv-2602.12606%20(RelBench%20v2)-b31b1b.svg" alt="arXiv: RelBench v2" /></a>
|
|
49
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-3f9e78.svg" alt="License: MIT" /></a>
|
|
50
|
+
</p>
|
|
51
|
+
|
|
52
|
+
<p align="center">
|
|
53
|
+
<a href="#news"><b>News</b></a> ·
|
|
54
|
+
<a href="#get-started"><b>Get Started</b></a> ·
|
|
55
|
+
<a href="#tutorials"><b>Tutorials</b></a> ·
|
|
56
|
+
<a href="#leaderboard"><b>Leaderboard</b></a> ·
|
|
57
|
+
<a href="#byod-bring-your-own-data"><b>BYOD</b></a> ·
|
|
58
|
+
<a href="#citations"><b>Citations</b></a>
|
|
59
|
+
</p>
|
|
60
|
+
|
|
61
|
+
## News
|
|
62
|
+
|
|
63
|
+
RelBench 3 loads every dataset family below from the Hugging Face Hub with one call —
|
|
64
|
+
`relbench.load_dataset("<org>/<repo>/<name>")` — the core databases
|
|
65
|
+
([`stanford-star/relbench-v1`](https://huggingface.co/datasets/stanford-star/relbench-v1),
|
|
66
|
+
[`stanford-star/relbench-v2-extra`](https://huggingface.co/datasets/stanford-star/relbench-v2-extra)),
|
|
67
|
+
CTU/ReDeLEx ([`stanford-star/redelex`](https://huggingface.co/datasets/stanford-star/redelex)),
|
|
68
|
+
4DBInfer ([`stanford-star/dbinfer`](https://huggingface.co/datasets/stanford-star/dbinfer)) and
|
|
69
|
+
TGB ([`stanford-star/tgb`](https://huggingface.co/datasets/stanford-star/tgb)); the `[ctu]` extra is
|
|
70
|
+
gone. MIMIC-IV requires PhysioNet credentials and is not hosted. TGB and 4DBInfer tasks that
|
|
71
|
+
use their own scoring protocols load as data only (see [`MIGRATION.md`](MIGRATION.md)).
|
|
72
|
+
|
|
73
|
+
- **Aug 2026** — RelBench v3 released: datasets and tasks load straight from [Hugging Face](https://huggingface.co/stanford-star), a new [leaderboard](https://star-project.stanford.edu/relbench/leaderboard/) with automated submissions, and bug fixes ([migration guide](MIGRATION.md)).
|
|
74
|
+
- **Jun 2026** — Datasets, models, and community hub migrated to [Hugging Face](https://huggingface.co/stanford-star).
|
|
75
|
+
- **Mar 2026** — [RelBench v2 paper](https://arxiv.org/abs/2602.12606) accepted at the [ICLR 2026 DATA-FM workshop](https://data-fm-iclr2026.github.io/).
|
|
76
|
+
- **Feb 2026** — [Temporal Graph Benchmark](https://tgb.complexdatalab.com/) integration: time-stamped event streams as relational schemas.
|
|
77
|
+
- **Jan 2026** — RelBench v2 released: four new databases (SALT, RateBeer, arXiv, MIMIC-IV), 36 new tasks, and a new *Autocomplete* task type; plus 70+ CTU datasets via [ReDeLEx](https://github.com/jakubpeleska/redelex) and 7 from [4DBInfer](https://github.com/awslabs/multi-table-benchmark).
|
|
78
|
+
- **Jan 2026** — [ReDeLEx](https://arxiv.org/abs/2506.22199) integration: 70+ [CTU](https://relational.fel.cvut.cz/) relational databases via `relbench[ctu]`.
|
|
79
|
+
- **Sep 2024** — [RelBench paper](https://arxiv.org/abs/2407.20060) accepted at NeurIPS 2024 Datasets & Benchmarks Track.
|
|
80
|
+
- **Jul 2024** — RelBench released: the first open benchmark for predictive ML on relational databases.
|
|
81
|
+
- **May 2024** — [Relational Deep Learning position paper](https://arxiv.org/abs/2312.04615) accepted at ICML 2024.
|
|
82
|
+
- **Nov 2023** — Relational Deep Learning introduced in a keynote by Jure Leskovec at the [LoG Conference](https://logconference.org/) ([slides](https://drive.google.com/file/d/1Uk1y6c8z265G0wiRPpGT1cd5lts5lnKq/view)).
|
|
83
|
+
|
|
84
|
+
## Get Started
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
pip install relbench # data + task loading
|
|
88
|
+
pip install "relbench[example]" # + PyTorch Geometric & PyTorch Frame, for the GNN examples
|
|
89
|
+
pip install pyg-lib -f https://data.pyg.org/whl/torch-2.9.0+cpu.html # neighbor sampling; use the index matching your torch/CUDA build
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Load a dataset and a task — both come straight from the Hub, with **no per-dataset code**:
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
import relbench
|
|
96
|
+
|
|
97
|
+
dataset = relbench.load_dataset("rel-f1") # or a HuggingFace 'org/repo[/subdir]', or a local path
|
|
98
|
+
db = dataset.get_db() # rows after test_timestamp are hidden
|
|
99
|
+
|
|
100
|
+
task = dataset.load_task("driver-position") # dataset.get_task_names() lists them
|
|
101
|
+
train_table = task.get_table("train") # train / val / test label tables
|
|
102
|
+
test_table = task.get_table("test") # the target column is hidden on test
|
|
103
|
+
|
|
104
|
+
# ... train any model on db + train_table, predict on the test entities ...
|
|
105
|
+
metrics = task.evaluate(test_pred) # standard metric for the task type
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
`dataset.val_timestamp` / `dataset.test_timestamp` give the temporal split points. RelBench
|
|
109
|
+
is framework-agnostic — bring any modeling stack. For a reference Graph Neural Network on
|
|
110
|
+
[PyTorch Geometric](https://github.com/pyg-team/pytorch_geometric) +
|
|
111
|
+
[PyTorch Frame](https://github.com/pyg-team/pytorch-frame), see `relbench.modeling` and the
|
|
112
|
+
runnable scripts in [`examples/`](examples).
|
|
113
|
+
|
|
114
|
+
### Tutorials
|
|
115
|
+
|
|
116
|
+
Open these directly in Google Colab — no setup required:
|
|
117
|
+
|
|
118
|
+
| Tutorial | What it covers | |
|
|
119
|
+
|---|---|---|
|
|
120
|
+
| [**Quickstart**](https://colab.research.google.com/github/stanford-star/relbench/blob/main/tutorials/quickstart.ipynb) | Load a dataset/task, explore the schema, run a baseline | [](https://colab.research.google.com/github/stanford-star/relbench/blob/main/tutorials/quickstart.ipynb) |
|
|
121
|
+
| [**Training a GNN**](https://colab.research.google.com/github/stanford-star/relbench/blob/main/tutorials/gnn.ipynb) | A GNN baseline for an entity task (PyG + PyTorch Frame) | [](https://colab.research.google.com/github/stanford-star/relbench/blob/main/tutorials/gnn.ipynb) |
|
|
122
|
+
|
|
123
|
+
## Leaderboard
|
|
124
|
+
|
|
125
|
+
The [**RelBench leaderboard**](https://star-project.stanford.edu/relbench/leaderboard/)
|
|
126
|
+
ranks methods by their test-set performance, averaged over a fixed task set. There are
|
|
127
|
+
three independent boards — **classification** (12 tasks), **regression** (9), and
|
|
128
|
+
**recommendation** (10); the task lists are in `relbench.submit.LEADERBOARD_TASKS`.
|
|
129
|
+
You can submit to any of them; each requires predictions for *all* of its tasks.
|
|
130
|
+
|
|
131
|
+
To submit:
|
|
132
|
+
|
|
133
|
+
1. **Write one prediction CSV per task**, named `<dataset>__<task>.csv`, into a directory:
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
relbench.submit.write_prediction_table(task, test_pred, "preds/rel-f1__driver-position.csv")
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
2. **Validate and package** the directory — this scores every CSV against the test tables,
|
|
140
|
+
prints a verdict per leaderboard, and writes clean submission zip file(s):
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
python -m relbench.submit preds/
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
3. **[Open a submission issue](https://github.com/stanford-star/relbench/issues/new?template=submit.yml)**
|
|
147
|
+
on this repository: fill in the short form and upload the zip file(s) into it.
|
|
148
|
+
|
|
149
|
+
The submission is validated automatically and the report is posted on the issue; once a
|
|
150
|
+
maintainer approves, your entry appears on the leaderboard.
|
|
151
|
+
|
|
152
|
+
## BYOD (Bring Your Own Data)
|
|
153
|
+
|
|
154
|
+
You can easily express your own databases and tasks in the **RelBench format**.
|
|
155
|
+
A dataset is a self-describing folder — a
|
|
156
|
+
`manifest.yaml` (tables, keys, the foreign-key graph, the time splits), one plain parquet
|
|
157
|
+
per table, and a `tasks/` subdirectory — that you publish to the
|
|
158
|
+
[Hugging Face Hub](https://huggingface.co/stanford-star). RelBench loads it straight from its
|
|
159
|
+
`org/repo[/subdir]` address; there is no central registry to register with.
|
|
160
|
+
|
|
161
|
+
[**`byod/README.md`**](byod/README.md) is the full walkthrough, and the
|
|
162
|
+
published [`stanford-star/relbench-v1/rel-f1`](https://huggingface.co/datasets/stanford-star/relbench-v1) is a
|
|
163
|
+
complete worked example. For how RelBench's own databases were built, cleaned, and verified
|
|
164
|
+
from their original sources, see [`provenance/`](provenance).
|
|
165
|
+
|
|
166
|
+
If you upload your data in RelBench format to Hugging Face, please let us know
|
|
167
|
+
by opening an issue / making a PR so we can list it here!
|
|
168
|
+
|
|
169
|
+
## Citations
|
|
170
|
+
|
|
171
|
+
If you use RelBench, please cite the benchmark papers:
|
|
172
|
+
|
|
173
|
+
```bibtex
|
|
174
|
+
@inproceedings{relbench,
|
|
175
|
+
title={RelBench: A Benchmark for Deep Learning on Relational Databases},
|
|
176
|
+
author={Robinson, Joshua and Ranjan, Rishabh and Hu, Weihua and Huang, Kexin and Han, Jiaqi and Dobles, Alejandro and Fey, Matthias and Lenssen, Jan Eric and Yuan, Yiwen and Zhang, Zecheng and He, Xinwei and Leskovec, Jure},
|
|
177
|
+
booktitle={Advances in Neural Information Processing Systems},
|
|
178
|
+
year={2024}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
@misc{relbenchv2,
|
|
182
|
+
title={RelBench v2: A Large-Scale Benchmark and Repository for Relational Data},
|
|
183
|
+
author={Gu, Justin and Ranjan, Rishabh and Kanatsoulis, Charilaos and Tang, Haiming and Jurkovic, Martin and Hudovernik, Valter and Znidar, Mark and Chaturvedi, Pranshu and Shroff, Parth and Li, Fengyu and Leskovec, Jure},
|
|
184
|
+
year={2026},
|
|
185
|
+
eprint={2602.12606},
|
|
186
|
+
archivePrefix={arXiv},
|
|
187
|
+
primaryClass={cs.LG},
|
|
188
|
+
url={https://arxiv.org/abs/2602.12606}
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Datasets sourced from external repositories (CTU/ReDeLEx, 4DBInfer, TGB) carry their own
|
|
193
|
+
citations on their [Hugging Face](https://huggingface.co/stanford-star) dataset cards.
|
|
194
|
+
|
relbench-3.0.0/README.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
<p align="center"><img src="https://star-project.stanford.edu/assets/img/relbench/logo.png" alt="RelBench" width="600px" /></p>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://star-project.stanford.edu/relbench"><img src="https://img.shields.io/badge/website-STAR%20Project-3f9e78.svg" alt="Website: STAR Project" /></a>
|
|
5
|
+
<a href="https://huggingface.co/stanford-star"><img src="https://img.shields.io/badge/data-%F0%9F%A4%97%20Hugging%20Face-ffcc00.svg" alt="Data: Hugging Face" /></a>
|
|
6
|
+
<a href="https://pypi.org/project/relbench/"><img src="https://img.shields.io/pypi/v/relbench?color=3f9e78" alt="PyPI" /></a>
|
|
7
|
+
<a href="https://github.com/stanford-star/relbench/actions/workflows/testing.yml"><img src="https://github.com/stanford-star/relbench/actions/workflows/testing.yml/badge.svg" alt="Tests" /></a>
|
|
8
|
+
<a href="https://arxiv.org/abs/2407.20060"><img src="https://img.shields.io/badge/arXiv-2407.20060%20(RelBench)-b31b1b.svg" alt="arXiv: RelBench" /></a>
|
|
9
|
+
<a href="https://arxiv.org/abs/2602.12606"><img src="https://img.shields.io/badge/arXiv-2602.12606%20(RelBench%20v2)-b31b1b.svg" alt="arXiv: RelBench v2" /></a>
|
|
10
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-3f9e78.svg" alt="License: MIT" /></a>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<a href="#news"><b>News</b></a> ·
|
|
15
|
+
<a href="#get-started"><b>Get Started</b></a> ·
|
|
16
|
+
<a href="#tutorials"><b>Tutorials</b></a> ·
|
|
17
|
+
<a href="#leaderboard"><b>Leaderboard</b></a> ·
|
|
18
|
+
<a href="#byod-bring-your-own-data"><b>BYOD</b></a> ·
|
|
19
|
+
<a href="#citations"><b>Citations</b></a>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
## News
|
|
23
|
+
|
|
24
|
+
RelBench 3 loads every dataset family below from the Hugging Face Hub with one call —
|
|
25
|
+
`relbench.load_dataset("<org>/<repo>/<name>")` — the core databases
|
|
26
|
+
([`stanford-star/relbench-v1`](https://huggingface.co/datasets/stanford-star/relbench-v1),
|
|
27
|
+
[`stanford-star/relbench-v2-extra`](https://huggingface.co/datasets/stanford-star/relbench-v2-extra)),
|
|
28
|
+
CTU/ReDeLEx ([`stanford-star/redelex`](https://huggingface.co/datasets/stanford-star/redelex)),
|
|
29
|
+
4DBInfer ([`stanford-star/dbinfer`](https://huggingface.co/datasets/stanford-star/dbinfer)) and
|
|
30
|
+
TGB ([`stanford-star/tgb`](https://huggingface.co/datasets/stanford-star/tgb)); the `[ctu]` extra is
|
|
31
|
+
gone. MIMIC-IV requires PhysioNet credentials and is not hosted. TGB and 4DBInfer tasks that
|
|
32
|
+
use their own scoring protocols load as data only (see [`MIGRATION.md`](MIGRATION.md)).
|
|
33
|
+
|
|
34
|
+
- **Aug 2026** — RelBench v3 released: datasets and tasks load straight from [Hugging Face](https://huggingface.co/stanford-star), a new [leaderboard](https://star-project.stanford.edu/relbench/leaderboard/) with automated submissions, and bug fixes ([migration guide](MIGRATION.md)).
|
|
35
|
+
- **Jun 2026** — Datasets, models, and community hub migrated to [Hugging Face](https://huggingface.co/stanford-star).
|
|
36
|
+
- **Mar 2026** — [RelBench v2 paper](https://arxiv.org/abs/2602.12606) accepted at the [ICLR 2026 DATA-FM workshop](https://data-fm-iclr2026.github.io/).
|
|
37
|
+
- **Feb 2026** — [Temporal Graph Benchmark](https://tgb.complexdatalab.com/) integration: time-stamped event streams as relational schemas.
|
|
38
|
+
- **Jan 2026** — RelBench v2 released: four new databases (SALT, RateBeer, arXiv, MIMIC-IV), 36 new tasks, and a new *Autocomplete* task type; plus 70+ CTU datasets via [ReDeLEx](https://github.com/jakubpeleska/redelex) and 7 from [4DBInfer](https://github.com/awslabs/multi-table-benchmark).
|
|
39
|
+
- **Jan 2026** — [ReDeLEx](https://arxiv.org/abs/2506.22199) integration: 70+ [CTU](https://relational.fel.cvut.cz/) relational databases via `relbench[ctu]`.
|
|
40
|
+
- **Sep 2024** — [RelBench paper](https://arxiv.org/abs/2407.20060) accepted at NeurIPS 2024 Datasets & Benchmarks Track.
|
|
41
|
+
- **Jul 2024** — RelBench released: the first open benchmark for predictive ML on relational databases.
|
|
42
|
+
- **May 2024** — [Relational Deep Learning position paper](https://arxiv.org/abs/2312.04615) accepted at ICML 2024.
|
|
43
|
+
- **Nov 2023** — Relational Deep Learning introduced in a keynote by Jure Leskovec at the [LoG Conference](https://logconference.org/) ([slides](https://drive.google.com/file/d/1Uk1y6c8z265G0wiRPpGT1cd5lts5lnKq/view)).
|
|
44
|
+
|
|
45
|
+
## Get Started
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install relbench # data + task loading
|
|
49
|
+
pip install "relbench[example]" # + PyTorch Geometric & PyTorch Frame, for the GNN examples
|
|
50
|
+
pip install pyg-lib -f https://data.pyg.org/whl/torch-2.9.0+cpu.html # neighbor sampling; use the index matching your torch/CUDA build
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Load a dataset and a task — both come straight from the Hub, with **no per-dataset code**:
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
import relbench
|
|
57
|
+
|
|
58
|
+
dataset = relbench.load_dataset("rel-f1") # or a HuggingFace 'org/repo[/subdir]', or a local path
|
|
59
|
+
db = dataset.get_db() # rows after test_timestamp are hidden
|
|
60
|
+
|
|
61
|
+
task = dataset.load_task("driver-position") # dataset.get_task_names() lists them
|
|
62
|
+
train_table = task.get_table("train") # train / val / test label tables
|
|
63
|
+
test_table = task.get_table("test") # the target column is hidden on test
|
|
64
|
+
|
|
65
|
+
# ... train any model on db + train_table, predict on the test entities ...
|
|
66
|
+
metrics = task.evaluate(test_pred) # standard metric for the task type
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
`dataset.val_timestamp` / `dataset.test_timestamp` give the temporal split points. RelBench
|
|
70
|
+
is framework-agnostic — bring any modeling stack. For a reference Graph Neural Network on
|
|
71
|
+
[PyTorch Geometric](https://github.com/pyg-team/pytorch_geometric) +
|
|
72
|
+
[PyTorch Frame](https://github.com/pyg-team/pytorch-frame), see `relbench.modeling` and the
|
|
73
|
+
runnable scripts in [`examples/`](examples).
|
|
74
|
+
|
|
75
|
+
### Tutorials
|
|
76
|
+
|
|
77
|
+
Open these directly in Google Colab — no setup required:
|
|
78
|
+
|
|
79
|
+
| Tutorial | What it covers | |
|
|
80
|
+
|---|---|---|
|
|
81
|
+
| [**Quickstart**](https://colab.research.google.com/github/stanford-star/relbench/blob/main/tutorials/quickstart.ipynb) | Load a dataset/task, explore the schema, run a baseline | [](https://colab.research.google.com/github/stanford-star/relbench/blob/main/tutorials/quickstart.ipynb) |
|
|
82
|
+
| [**Training a GNN**](https://colab.research.google.com/github/stanford-star/relbench/blob/main/tutorials/gnn.ipynb) | A GNN baseline for an entity task (PyG + PyTorch Frame) | [](https://colab.research.google.com/github/stanford-star/relbench/blob/main/tutorials/gnn.ipynb) |
|
|
83
|
+
|
|
84
|
+
## Leaderboard
|
|
85
|
+
|
|
86
|
+
The [**RelBench leaderboard**](https://star-project.stanford.edu/relbench/leaderboard/)
|
|
87
|
+
ranks methods by their test-set performance, averaged over a fixed task set. There are
|
|
88
|
+
three independent boards — **classification** (12 tasks), **regression** (9), and
|
|
89
|
+
**recommendation** (10); the task lists are in `relbench.submit.LEADERBOARD_TASKS`.
|
|
90
|
+
You can submit to any of them; each requires predictions for *all* of its tasks.
|
|
91
|
+
|
|
92
|
+
To submit:
|
|
93
|
+
|
|
94
|
+
1. **Write one prediction CSV per task**, named `<dataset>__<task>.csv`, into a directory:
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
relbench.submit.write_prediction_table(task, test_pred, "preds/rel-f1__driver-position.csv")
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
2. **Validate and package** the directory — this scores every CSV against the test tables,
|
|
101
|
+
prints a verdict per leaderboard, and writes clean submission zip file(s):
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
python -m relbench.submit preds/
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
3. **[Open a submission issue](https://github.com/stanford-star/relbench/issues/new?template=submit.yml)**
|
|
108
|
+
on this repository: fill in the short form and upload the zip file(s) into it.
|
|
109
|
+
|
|
110
|
+
The submission is validated automatically and the report is posted on the issue; once a
|
|
111
|
+
maintainer approves, your entry appears on the leaderboard.
|
|
112
|
+
|
|
113
|
+
## BYOD (Bring Your Own Data)
|
|
114
|
+
|
|
115
|
+
You can easily express your own databases and tasks in the **RelBench format**.
|
|
116
|
+
A dataset is a self-describing folder — a
|
|
117
|
+
`manifest.yaml` (tables, keys, the foreign-key graph, the time splits), one plain parquet
|
|
118
|
+
per table, and a `tasks/` subdirectory — that you publish to the
|
|
119
|
+
[Hugging Face Hub](https://huggingface.co/stanford-star). RelBench loads it straight from its
|
|
120
|
+
`org/repo[/subdir]` address; there is no central registry to register with.
|
|
121
|
+
|
|
122
|
+
[**`byod/README.md`**](byod/README.md) is the full walkthrough, and the
|
|
123
|
+
published [`stanford-star/relbench-v1/rel-f1`](https://huggingface.co/datasets/stanford-star/relbench-v1) is a
|
|
124
|
+
complete worked example. For how RelBench's own databases were built, cleaned, and verified
|
|
125
|
+
from their original sources, see [`provenance/`](provenance).
|
|
126
|
+
|
|
127
|
+
If you upload your data in RelBench format to Hugging Face, please let us know
|
|
128
|
+
by opening an issue / making a PR so we can list it here!
|
|
129
|
+
|
|
130
|
+
## Citations
|
|
131
|
+
|
|
132
|
+
If you use RelBench, please cite the benchmark papers:
|
|
133
|
+
|
|
134
|
+
```bibtex
|
|
135
|
+
@inproceedings{relbench,
|
|
136
|
+
title={RelBench: A Benchmark for Deep Learning on Relational Databases},
|
|
137
|
+
author={Robinson, Joshua and Ranjan, Rishabh and Hu, Weihua and Huang, Kexin and Han, Jiaqi and Dobles, Alejandro and Fey, Matthias and Lenssen, Jan Eric and Yuan, Yiwen and Zhang, Zecheng and He, Xinwei and Leskovec, Jure},
|
|
138
|
+
booktitle={Advances in Neural Information Processing Systems},
|
|
139
|
+
year={2024}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@misc{relbenchv2,
|
|
143
|
+
title={RelBench v2: A Large-Scale Benchmark and Repository for Relational Data},
|
|
144
|
+
author={Gu, Justin and Ranjan, Rishabh and Kanatsoulis, Charilaos and Tang, Haiming and Jurkovic, Martin and Hudovernik, Valter and Znidar, Mark and Chaturvedi, Pranshu and Shroff, Parth and Li, Fengyu and Leskovec, Jure},
|
|
145
|
+
year={2026},
|
|
146
|
+
eprint={2602.12606},
|
|
147
|
+
archivePrefix={arXiv},
|
|
148
|
+
primaryClass={cs.LG},
|
|
149
|
+
url={https://arxiv.org/abs/2602.12606}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Datasets sourced from external repositories (CTU/ReDeLEx, 4DBInfer, TGB) carry their own
|
|
154
|
+
citations on their [Hugging Face](https://huggingface.co/stanford-star) dataset cards.
|
|
@@ -4,31 +4,42 @@ build-backend = "flit_core.buildapi"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "relbench"
|
|
7
|
-
version = "
|
|
7
|
+
version = "3.0.0"
|
|
8
8
|
description = "RelBench: Relational Deep Learning Benchmark"
|
|
9
9
|
authors = [{name = "RelBench Team", email = "relbench@cs.stanford.edu"}]
|
|
10
10
|
readme = "README.md"
|
|
11
11
|
license = {file = "LICENSE"}
|
|
12
12
|
classifiers = [
|
|
13
13
|
"License :: OSI Approved :: MIT License",
|
|
14
|
+
"Programming Language :: Python :: 3.10",
|
|
15
|
+
"Programming Language :: Python :: 3.11",
|
|
16
|
+
"Programming Language :: Python :: 3.12",
|
|
17
|
+
"Programming Language :: Python :: 3.13",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
14
19
|
]
|
|
15
20
|
requires-python=">=3.10"
|
|
16
|
-
keywords=[
|
|
21
|
+
keywords=[
|
|
22
|
+
"relational deep learning",
|
|
23
|
+
"graph neural networks",
|
|
24
|
+
"relational databases",
|
|
25
|
+
"benchmark",
|
|
26
|
+
"machine learning",
|
|
27
|
+
]
|
|
17
28
|
dependencies=[
|
|
18
29
|
"pandas",
|
|
19
|
-
"
|
|
30
|
+
"huggingface_hub",
|
|
31
|
+
"pyyaml",
|
|
20
32
|
"pyarrow",
|
|
21
33
|
"numpy",
|
|
22
34
|
"duckdb",
|
|
23
|
-
"scikit-learn
|
|
35
|
+
"scikit-learn",
|
|
24
36
|
"typing-extensions",
|
|
25
|
-
"
|
|
37
|
+
"tqdm",
|
|
26
38
|
]
|
|
27
39
|
|
|
28
40
|
[project.optional-dependencies]
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
"torch_geometric",
|
|
41
|
+
schema=[
|
|
42
|
+
"graphviz",
|
|
32
43
|
]
|
|
33
44
|
example=[
|
|
34
45
|
"sentence-transformers",
|
|
@@ -36,26 +47,23 @@ example=[
|
|
|
36
47
|
"torch_geometric",
|
|
37
48
|
"tqdm",
|
|
38
49
|
]
|
|
39
|
-
test=[
|
|
40
|
-
"pytest",
|
|
41
|
-
]
|
|
42
50
|
dev=[
|
|
51
|
+
"pytest",
|
|
43
52
|
"pre-commit",
|
|
44
53
|
]
|
|
45
|
-
dbinfer=[
|
|
46
|
-
"dbinfer-relbench-adapter",
|
|
47
|
-
"db-dtypes",
|
|
48
|
-
]
|
|
49
|
-
ctu=[
|
|
50
|
-
"redelex",
|
|
51
|
-
]
|
|
52
54
|
|
|
53
55
|
[project.urls]
|
|
54
|
-
Home = "https://
|
|
56
|
+
Home = "https://star-project.stanford.edu/relbench"
|
|
57
|
+
Repository = "https://github.com/stanford-star/relbench"
|
|
58
|
+
Issues = "https://github.com/stanford-star/relbench/issues"
|
|
59
|
+
Data = "https://huggingface.co/stanford-star"
|
|
55
60
|
|
|
56
61
|
[tool.flit.module]
|
|
57
62
|
name="relbench"
|
|
58
63
|
|
|
64
|
+
[tool.black]
|
|
65
|
+
target-version = ["py310"]
|
|
66
|
+
|
|
59
67
|
[tool.pytest.ini_options]
|
|
60
68
|
addopts = [
|
|
61
69
|
"--capture=no",
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
2
|
+
|
|
3
|
+
from relbench import base
|
|
4
|
+
from relbench.load import load_dataset, train_std
|
|
5
|
+
|
|
6
|
+
try:
|
|
7
|
+
__version__ = version("relbench")
|
|
8
|
+
except PackageNotFoundError:
|
|
9
|
+
__version__ = "0.0.0"
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
"__version__",
|
|
13
|
+
"base",
|
|
14
|
+
"modeling",
|
|
15
|
+
"load_dataset",
|
|
16
|
+
"train_std",
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def __getattr__(name):
|
|
21
|
+
# `relbench.modeling` pulls in torch / PyTorch Geometric, which data-only users (and the
|
|
22
|
+
# in-browser WebAssembly tutorials) don't need. Import it lazily on first access so plain
|
|
23
|
+
# `import relbench` + load_dataset/get_db stays torch-free.
|
|
24
|
+
if name == "modeling":
|
|
25
|
+
import importlib
|
|
26
|
+
|
|
27
|
+
return importlib.import_module("relbench.modeling")
|
|
28
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from .database import Database
|
|
2
|
-
from .dataset import Dataset
|
|
3
|
-
from .table import Table
|
|
2
|
+
from .dataset import Dataset, drop_columns
|
|
3
|
+
from .table import Table, is_time_sorted
|
|
4
4
|
from .task_autocomplete import AutoCompleteTask
|
|
5
5
|
from .task_base import BaseTask, TaskType
|
|
6
6
|
from .task_entity import EntityTask
|
|
@@ -9,7 +9,9 @@ from .task_recommendation import RecommendationTask
|
|
|
9
9
|
__all__ = [
|
|
10
10
|
"Database",
|
|
11
11
|
"Dataset",
|
|
12
|
+
"drop_columns",
|
|
12
13
|
"Table",
|
|
14
|
+
"is_time_sorted",
|
|
13
15
|
"BaseTask",
|
|
14
16
|
"TaskType",
|
|
15
17
|
"RecommendationTask",
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from typing import Dict
|
|
2
|
+
|
|
3
|
+
import pandas as pd
|
|
4
|
+
from typing_extensions import Self
|
|
5
|
+
|
|
6
|
+
from .table import Table
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Database:
|
|
10
|
+
r"""A database is a collection of named tables linked by foreign key - primary key
|
|
11
|
+
connections."""
|
|
12
|
+
|
|
13
|
+
def __init__(self, table_dict: Dict[str, Table]) -> None:
|
|
14
|
+
r"""Creates a database from a dictionary of tables."""
|
|
15
|
+
|
|
16
|
+
self.table_dict = table_dict
|
|
17
|
+
|
|
18
|
+
def __repr__(self) -> str:
|
|
19
|
+
tables = ", ".join(f"{name}={len(t)}" for name, t in self.table_dict.items())
|
|
20
|
+
return f"{self.__class__.__name__}({tables})"
|
|
21
|
+
|
|
22
|
+
@property
|
|
23
|
+
def min_timestamp(self) -> pd.Timestamp:
|
|
24
|
+
r"""Return the earliest timestamp in the database."""
|
|
25
|
+
|
|
26
|
+
return min(
|
|
27
|
+
table.min_timestamp
|
|
28
|
+
for table in self.table_dict.values()
|
|
29
|
+
if table.time_col is not None
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
@property
|
|
33
|
+
def max_timestamp(self) -> pd.Timestamp:
|
|
34
|
+
r"""Return the latest timestamp in the database."""
|
|
35
|
+
|
|
36
|
+
return max(
|
|
37
|
+
table.max_timestamp
|
|
38
|
+
for table in self.table_dict.values()
|
|
39
|
+
if table.time_col is not None
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
def upto(self, timestamp: pd.Timestamp) -> Self:
|
|
43
|
+
r"""Return a database with all rows upto timestamp."""
|
|
44
|
+
|
|
45
|
+
return Database(
|
|
46
|
+
table_dict={
|
|
47
|
+
name: table.upto(timestamp) for name, table in self.table_dict.items()
|
|
48
|
+
}
|
|
49
|
+
)
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import warnings
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
import pandas as pd
|
|
5
|
+
|
|
6
|
+
from .database import Database
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Dataset:
|
|
10
|
+
r"""A dataset is a database with validation and test timestamps defined for it.
|
|
11
|
+
|
|
12
|
+
Attributes:
|
|
13
|
+
val_timestamp: Rows upto this timestamp (inclusive) can be input for validation.
|
|
14
|
+
test_timestamp: Rows upto this timestamp (inclusive) can be input for testing.
|
|
15
|
+
|
|
16
|
+
Validation split of a task involves predicting the target variable for a
|
|
17
|
+
time period after val_timestamp (exclusive) using data upto val_timestamp.
|
|
18
|
+
Similarly for test_timestamp.
|
|
19
|
+
|
|
20
|
+
``get_db`` is a pure function of the underlying data: it holds no state, caches
|
|
21
|
+
nothing, and never depends on which tasks have been loaded. Materializing a
|
|
22
|
+
database is expensive, so **callers should keep the object they get back** rather
|
|
23
|
+
than calling ``get_db`` repeatedly. For a view with the columns a task must not
|
|
24
|
+
see removed, use :meth:`relbench.base.BaseTask.get_db`.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
# To be set by subclass.
|
|
28
|
+
val_timestamp: pd.Timestamp
|
|
29
|
+
test_timestamp: pd.Timestamp
|
|
30
|
+
|
|
31
|
+
def __repr__(self) -> str:
|
|
32
|
+
return f"{self.__class__.__name__}()"
|
|
33
|
+
|
|
34
|
+
def validate_and_correct_db(self, db):
|
|
35
|
+
r"""Validate and correct input db in-place.
|
|
36
|
+
|
|
37
|
+
Removing rows after test_timestamp can result in dangling foreign keys.
|
|
38
|
+
"""
|
|
39
|
+
# Validate that all primary keys are consecutively index.
|
|
40
|
+
|
|
41
|
+
for table_name, table in db.table_dict.items():
|
|
42
|
+
if table.pkey_col is not None:
|
|
43
|
+
ser = table.df[table.pkey_col]
|
|
44
|
+
if not (ser.values == np.arange(len(ser))).all():
|
|
45
|
+
raise RuntimeError(
|
|
46
|
+
f"The primary key column {table.pkey_col} of table "
|
|
47
|
+
f"{table_name} is not consecutively indexed (0..n-1 in row "
|
|
48
|
+
"order), which RelBench requires. Hosted datasets are; for your "
|
|
49
|
+
"own data run `python byod/reindex_dataset.py <dataset_dir>` "
|
|
50
|
+
"(see byod/README.md)."
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
# Discard any foreign keys that are larger than primary key table as
|
|
54
|
+
# dangling foreign keys (represented as None).
|
|
55
|
+
for table_name, table in db.table_dict.items():
|
|
56
|
+
for fkey_col, pkey_table_name in table.fkey_col_to_pkey_table.items():
|
|
57
|
+
num_pkeys = len(db.table_dict[pkey_table_name])
|
|
58
|
+
mask = table.df[fkey_col] >= num_pkeys
|
|
59
|
+
if mask.any():
|
|
60
|
+
table.df.loc[mask, fkey_col] = None
|
|
61
|
+
|
|
62
|
+
def get_db(self, upto_test_timestamp: bool = True) -> Database:
|
|
63
|
+
r"""Build and return the database object.
|
|
64
|
+
|
|
65
|
+
Args:
|
|
66
|
+
upto_test_timestamp: If True, only return rows upto test_timestamp.
|
|
67
|
+
|
|
68
|
+
Returns:
|
|
69
|
+
Database: A freshly built database object.
|
|
70
|
+
|
|
71
|
+
`upto_test_timestamp` is True by default to prevent test leakage.
|
|
72
|
+
|
|
73
|
+
``make_db`` must return tables whose keys already follow the RelBench key
|
|
74
|
+
contract (primary keys ``0..n-1`` in row order, foreign keys holding those
|
|
75
|
+
indices); ``byod/reindex_dataset.py`` normalizes a dataset folder into it.
|
|
76
|
+
|
|
77
|
+
Nothing is cached: every call rebuilds the database. Hold on to the returned
|
|
78
|
+
object instead of calling this repeatedly.
|
|
79
|
+
"""
|
|
80
|
+
db = self.make_db()
|
|
81
|
+
|
|
82
|
+
if upto_test_timestamp:
|
|
83
|
+
db = db.upto(self.test_timestamp)
|
|
84
|
+
|
|
85
|
+
self.validate_and_correct_db(db)
|
|
86
|
+
return db
|
|
87
|
+
|
|
88
|
+
def make_db(self) -> Database:
|
|
89
|
+
r"""Make the database object from scratch, i.e. using raw data sources, with keys
|
|
90
|
+
already normalized (see :meth:`get_db`).
|
|
91
|
+
|
|
92
|
+
To be implemented by subclass.
|
|
93
|
+
"""
|
|
94
|
+
raise NotImplementedError
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def drop_columns(db: Database, remove_columns) -> Database:
|
|
98
|
+
r"""Drop ``(table, column)`` pairs from ``db`` in place, and return it.
|
|
99
|
+
|
|
100
|
+
These are the columns a task must not see -- the ones its label is, or is derived
|
|
101
|
+
from. Applied per task in :meth:`relbench.base.BaseTask.get_db`, never stored on
|
|
102
|
+
the dataset, so two tasks over one dataset cannot disturb each other.
|
|
103
|
+
"""
|
|
104
|
+
for table, remove_col in remove_columns:
|
|
105
|
+
if table not in db.table_dict:
|
|
106
|
+
warnings.warn(
|
|
107
|
+
f"Table {table} not in the database. "
|
|
108
|
+
f"Skipping removal of column {remove_col}.",
|
|
109
|
+
stacklevel=2,
|
|
110
|
+
)
|
|
111
|
+
continue
|
|
112
|
+
if remove_col in db.table_dict[table].df.columns:
|
|
113
|
+
db.table_dict[table].df = db.table_dict[table].df.drop(columns=[remove_col])
|
|
114
|
+
else:
|
|
115
|
+
warnings.warn(
|
|
116
|
+
f"Column {remove_col} not found in table {table}. "
|
|
117
|
+
"Skipping removal from this table.",
|
|
118
|
+
stacklevel=2,
|
|
119
|
+
)
|
|
120
|
+
return db
|