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
- dbt Core
- MetricFlow
- dbt Contracts and Tests
- DuckDB
- Python
- Claude API
Skills you can demonstrate
Analytics Engineering, Metric Definition, Data Governance, Data Contracts, Text-to-SQL Guardrails
Build roadmap
- 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. - 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. - 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. - 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. - 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. - 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
- GitHub: The dbt project with semantic models, contracts, tests, the query interface, and a screenshot of the same metric matching in the dashboard and the chat.
- LinkedIn: Show the chat: ask "revenue by region last quarter", show the compiled SQL and the result, then show the dashboard tile with the identical number.
- Resume: Speak the language of the role: "Built a dbt semantic layer with data contracts and a governed natural-language query interface."