Your complete roadmap to mastering dbt. From understanding Analytics Engineering fundamentals to building production-ready transformation pipelines.
By Alejandro Aboy
Published: 2026-04-02
URL: https://thepipeandtheline.substack.com/p/the-complete-dbt-guide-from-sql-to
Hi there! Alejandro here 😊
Subscribe if you like to read about technical data & AI learnings, deep dives!
Enjoy the reading and let me know in the comments what you think about it 👨🏻💻
📝 TL;DR
- 8 articles covering the full dbt journey from SQL analyst to production-ready pipelines
- One GitHub repo sql-to-dbt-series as the hands-on companion for the entire series
- Learning path: mindset → foundations → architecture → quality → macros → snapshots → internals → production
- Plus advanced topics: portable data stacks, agentic data modeling with AI, and AI-assisted modeling workflows
- Start wherever your skill level is. Each article stands alone but the sequence builds on itself
\Image generated with ChatGPT\
Core dbt Series
Getting Started
SQL to dbt: Get Started with Analytics Engineering
Understand why SQL analysts are stuck in old workflows and how Analytics Engineering changes everything. Learn the mindset shift from ad-hoc queries to version-controlled, testable transformation pipelines.
Move from Excel exports and manual SQL scripts to git-based workflows, automated testing, and collaborative data development.
SQL to dbt guide: Your dbt Starter Pack Project
Build your first dbt project from scratch using DuckDB and synthetic marketing data. Learn project structure, materializations, Jinja macros, and essential commands through hands-on practice.
You will build a complete dbt-core project with tests, contracts, and full medallion architecture using messy marketing datasets.
Architecture & Organization
SQL to dbt guide: How Data Layers Flow With Medallion Architecture
Master the Bronze/Silver/Gold pattern (Medallion architecture) to organize transformations logically. Learn when to use staging vs intermediate vs mart layers, and why folder structure matters more than you think.
Medallion isn’t about strict rules. It’s about creating logical flows that scale with your team and business.
Testing & Quality
SQL to dbt guide: Hands-on Data Quality & Integrity Worfklows
Understand the difference between data integrity (keeps pipelines running) and data quality (prevents bad decisions). Implement data contracts, generic tests, singular tests, and statistical validation with dbt-expectations.
Contracts block bad schemas during compilation, while tests catch quality issues after builds.
Macros & Reusability
SQL to dbt guide - Macros & Code Reusability
DRY principles done right. The repo has raw SQL and macro versions of the same attribution logic side by side so you can see exactly what macros buy you. Covers all five project macros: performance classification, safe division, target comparison, percentage calculations, and touchpoint attribution.
The before-and-after comparison between int\first\touchpoints.sql (raw SQL) and eph\first\touchpoints.sql (macro) tells the whole story. Six repeated window functions reduced to a single invocation.
Historical Tracking
SQL to dbt guide - Slowly Changing Dimensions with dbt Snapshots
Track how data changes over time using dbt snapshots for SCD2 patterns. Two strategies: timestamp for campaign metrics that update daily, check for visitor segment transitions. Includes three practical query patterns for time-travel analysis.
The strategy-to-use-case mapping is the core lesson. Timestamp when every change matters, check when you’re tracking categorical transitions.
Deep Dives & Advanced Topics
Understanding dbt Internals
Behind dbt’s Magic: Building A SQL Orchestrator with Python and DuckDB
Ever wondered what happens when you run dbt run? Reverse-engineer dbt’s core: dependency parsing with regex, DAG construction, topological sorting with Kahn’s algorithm, and ordered execution, all in ~500 lines of Python.
Understanding the internals means you’re not locked into any vendor’s ecosystem.
dbt in Practice
Portable Data Stack Concept with dbt, DuckDB, Sheets and Looker Studio
Build an end-to-end data stack using dbt-core, DuckDB, Python, GitHub Actions, Google Sheets, and Looker Studio. All portable, low-cost, and powerful enough for most small-to-medium data needs.
ETL with pure Python, transform with dbt-core + DuckDB, orchestrate with GitHub Actions (cron), export to Google Sheets, visualize with Looker Studio. All in a Docker container you can run anywhere.
End To End Agentic Data Modeling: Using AI and OpenMetadata MCP
What happens when you combine dbt with AI agents and a metadata platform? This co-authored project uses OpenMetadata’s MCP server to give AI real-time access to lineage, ownership, and impact analysis. A single schema change triggers full downstream visibility across dashboards and models.
dbt models alone don’t tell you what breaks downstream. Pairing them with a metadata layer turns AI from a code assistant into an impact analyst.
How AI Can Improve Your Data Modeling (And What’s Still Missing)
A hands-on look at using AI tools like Cursor and nao to speed up dbt development. The tab-jumping problem between DBeaver, terminal, and IDE is real, and new tools are closing that gap. But 90% of data modeling still happens outside the tools, in Miro boards, Slack threads, and stakeholder conversations.
AI can write your SQL faster, but it can’t replace the company context that makes good data models. Fix your documentation before expecting AI magic.
The Main Character: sql-to-dbt-series Repository
All examples, code, and hands-on exercises live here:
Repo: github.com/aboyalejandro/sql-to-dbt-series
What’s inside:
- Complete dbt-core project with DuckDB
- Messy synthetic marketing datasets (campaigns, ads, sessions, conversions)
- Docker setup for instant environment
- Full medallion architecture implementation
- Reusable macros for attribution, classification, and safe calculations
- Snapshots for campaign performance and visitor segment evolution
- Tests, contracts, and documentation examples
- Step-by-step exercises matching each article
Quick start: The repository is designed to fail on purpose in certain sections. You’ll learn by fixing real problems, not perfect examples.
If you enjoyed the content, hit the like ❤️ button, share, comment, repost, and all those nice things people do when like stuff these days. Glad to know you made it to this part!

Hi, I am Alejandro Aboy. I am currently working as a Data Engineer. I started in digital marketing at 19. I gained experience in website tracking, advertising, and analytics. I also founded my agency. In 2021, I found my passion for data engineering. So, I shifted my career focus, despite lacking a CS degree. I’m now pursuing this path, leveraging my diverse experience and willingness to learn.