Datasets:
license: mit
task_categories:
- translation
language:
- pt
tags:
- Text2SQL
- Text-to-SQL
pretty_name: AtlasSQL-BR
size_categories:
- 1K<n<10K
AtlasSQL-BR
AtlasSQL-BR is a novel geospatial Text-to-SQL dataset in Brazilian Portuguese, built upon real-world open-government data. Integrating school census data, public facility registries, and Brazil's official geographic boundary hierarchies, this dataset provides a robust benchmark for evaluating and training models on spatial queries.
π Dataset Architecture and Structure
The database schema underlying AtlasSQL-BR is organized around thematic public facility tables and their associated geographic boundary layers. This multi-level structure requires models to reason about spatial containment across different administrative granularities within a single SQL statement.
- Thematic Tables (Point Geometries): The core table is
microdados_ed_basica, derived from the Brazilian School Census, containing hundreds of infrastructural and pedagogical attributes per school. The schema also includes georeferenced records for other public facilities: libraries, CRAS, CREAS, and Centros POP. - Boundary Tables (Polygon Geometries): The dataset incorporates all seven official geographic boundary levels from IBGE: country, macro-region, state, municipality, district, neighborhood, and street.
- Spatial Operators: Spatial relationships between facility points and boundary polygons are resolved using PostGIS extensions. The dataset covers a vocabulary of 22 PostGIS spatial functions (e.g.,
ST_Intersects,ST_Within,ST_Contains,ST_Distance).
Data Fields
Based on the dataset structure, each record contains the following fields:
question: The natural language query in Brazilian Portuguese.sql_code: The corresponding executable PostGIS/SQL query.territorial_division: The administrative boundary level relevant to the query.level: The structural complexity tier of the query.geospatial_functions: The primary PostGIS functions required to solve the query.source: Indicates the origin of the data. It can bebase_dataset(the original 980 manually annotated questions) or partitions generated by data augmentation techniques (such asdelete,insert,swap,synonym,translate).
π Complexity Tiers
The dataset comprises manually annotated question-SQL pairs classified into four complexity tiers based on the structural properties of the SQL query (all criteria are AND-combined within each tier):
| Tier | Structural Criteria |
|---|---|
| Easy | <1 JOIN; no aggregations; no subqueries; direct spatial filter. |
| Medium | 2-3 JOINs; no aggregations; multiple spatial conditions. |
| Hard | 3-4 JOINs; >1 aggregation (COUNT, SUM, AVG); multiple spatial functions. |
| Very Hard | 4+ JOINs; multiple aggregations; subqueries and/or CTEs; window functions (ROW_NUMBER, RANK, DENSE_RANK); CASE WHEN; possible UNION. |
π Files and Reproducibility
The dataset is divided into standard train.parquet and validation.parquet splits.
β οΈ Important Note on Reproducibility: The baseline experiments documented in the original paper were conducted exclusively on the original 980 question-SQL pairs. The dataset files available here also include additional data generated through data augmentation techniques.
To exactly replicate the experiments and results from the original paper, you must:
- Use the dataset version associated with the
paper-releasedtag. - Filter the data to include only the records where the
sourcecolumn is exactlybase_dataset. The other partitions (delete,insert,swap,synonym,translate) contain synthetic augmented data and should be excluded when reproducing the paper's base results.
How to load the dataset for reproducibility (Python)
You can easily download and filter the dataset using the Hugging Face datasets library to match the exact setup used in the paper:
from datasets import load_dataset
# 1. Load the dataset using the specific tag for the paper's release
dataset = load_dataset("datafromlopes/atlas-sql-br", revision="paper-released")
# 2. Filter both train and validation splits to include only the original 980 questions
base_train = dataset["train"].filter(lambda x: x["source"] == "base_dataset")
base_validation = dataset["validation"].filter(lambda x: x["source"] == "base_dataset")
print(f"Original Train size: {len(base_train)}")
print(f"Original Validation size: {len(base_validation)}")
βοΈ Citation
If you find this dataset useful for your research, please cite the original paper: