Data Analysis
bsl-model-builder avatar

bsl-model-builder

Build, manage, and query semantic data models using the Boring Semantic Layer (BSL) for Ibis. Define dimensions, measures, joins, and YAML configurations for structured data analysis.

Introduction

The BSL Model Builder is an expert software agent skill designed to assist data engineers and analysts in architecting semantic models over raw data using the Boring Semantic Layer. It leverages the Ibis framework to provide a database-agnostic interface, supporting engines like DuckDB, Snowflake, BigQuery, and PostgreSQL. By abstracting raw SQL logic into reusable semantic components, the builder enables consistent metrics reporting, structured join logic, and modular data definitions suitable for production environments.

  • Define complex semantic tables by mapping Ibis expressions into named dimensions and measures.

  • Implement hierarchical grouping with time-based truncation (e.g., year, quarter, month, week, day) for time-series analysis.

  • Construct sophisticated aggregation logic including simple sums, averages, and complex ratio measures using t.all() for relative calculations like market share.

  • Manage relational data through one-to-many, one-to-one, and cross-joins with custom join keys and standard SQL join types (left, inner, outer).

  • Support both programmatic definition via Python and declarative configuration via YAML files, facilitating version control and reproducible workflows.

  • Utilize built-in AI-friendly documentation features like descriptive attributes for dimensions and measures, enhancing model discovery for downstream LLM-based data agents.

  • Expect inputs in the form of raw Ibis relations or established database connection profiles, and output structured SemanticTable objects or valid model configuration YAMLs.

  • Use the fluent API to chain operations such as .with_dimensions(), .with_measures(), and .join_many() for clean and readable code.

  • Ensure all definitions align with the BSL core principles of avoiding raw SQL where possible, favoring Ibis-native abstractions to maintain cross-backend portability.

  • For performance, organize large projects into separate YAML files to improve maintenance and collaboration across team environments.

  • Constraints include maintaining compatibility with the underlying Ibis expressions; ensure that all lambdas or deferred expressions (using _. syntax) are valid within the scope of the target Ibis table.

Repository Stats

Stars
436
Forks
39
Open Issues
10
Language
Python
Default Branch
main
Sync Status
Idle
Last Synced
Apr 29, 2026, 07:11 AM
View on GitHub