Data Analyst · intermediate

Semantic Layer and Data Contracts with dbt, Queried in Plain English

A dbt project where metrics are defined once in a semantic layer, protected by data contracts and tests, and exposed through a small natural-language interface that turns questions into governed SQL — so the AI and the dashboard always return the same number.

Project overview

The analytics engineer of 2026 is judged on contracts, tests, and machine-readable metric definitions that AI tools can query consistently, not on individual models. This project is that job description in miniature, and the plain-English layer makes it demo well.

Real-world use case

Three teams report three different "monthly active users." A semantic layer makes one definition the source of truth, and the chat interface lets a manager ask for it without knowing which table to join.

Tools and technologies

Skills you can demonstrate

Analytics Engineering, Metric Definition, Data Governance, Data Contracts, Text-to-SQL Guardrails

Build roadmap

  1. Model the data in dbt
    Staging and mart models for orders, customers, and products on DuckDB. Add schema tests for keys and not-null. Get a clean dbt build.
  2. Add data contracts
    Enforce a contract on the orders mart with explicit column types. Change a column and watch the build fail — that is the feature.
  3. Define the semantic layer
    Write semantic models and three metrics in MetricFlow. Query each from the command line and confirm the numbers match your mart queries.
  4. Build the plain-English layer
    A small Python app: question in, LLM maps it to metric, dimensions, and grain, the semantic layer compiles it, result out. Log every mapping.
  5. Add guardrails and tests
    Reject questions that do not map to a defined metric. Write twenty test questions with expected metric mappings and run them in CI.
  6. Prove consistency
    Build a tiny dashboard on the same metrics and show the chat and the dashboard agree. Document the governance story in the README.

Ways to extend the project

Add a CI check that fails a pull request if a contracted model’s schema changes, and a metrics changelog that is generated automatically from the semantic layer.

How to showcase your work

Open this project in BuildersBenchBrowse Data Analyst projects