
dbt - Advanced Features
Jinja macros, custom tests, packages, hooks, snapshots, incremental models, CI/CD orchestration
1What is the difference between a macro and a model in dbt?
What is the difference between a macro and a model in dbt?
Answer
A macro is a reusable Jinja code block that generates SQL dynamically, while a model is a SQL file that produces a table or view in the data warehouse. Macros help factorize repetitive code and create custom functions, whereas models define the structure of transformed data.
2How to declare a custom macro in dbt?
How to declare a custom macro in dbt?
Answer
A dbt macro is declared in a .sql file within the macros/ folder using Jinja macro and endmacro tags. The macro name is defined in the macro tag, and it can accept parameters. The macro is then callable in models using the Jinja double curly braces syntax.
3What is the main benefit of incremental models in dbt?
What is the main benefit of incremental models in dbt?
Answer
Incremental models allow processing only new or modified data since the last run, instead of rebuilding the entire table. This significantly reduces execution time and compute costs for large tables, while keeping data up to date.
What configuration is required to define an incremental model in dbt?
What is the purpose of the merge strategy in a dbt incremental model?
+17 interview questions
Other Data Analytics interview topics
Google Sheets - Fundamentals
Google Sheets - Advanced Formulas
SQL - Fundamentals
SQL - Aggregations and Grouping
SQL - Joins
BigQuery - Fundamentals
Data Cleaning
KPIs and Business Metrics
Descriptive Statistics
Zapier and No-Code Automation
Data Visualization Principles
Python & Pandas - Fundamentals
Google Sheets - Automated Dashboards
SQL - Subqueries and CTEs
SQL - Window Functions
BigQuery - Advanced Features
Data Modeling
Funnel and Conversion Analysis
Cohort and Retention Analysis
Google Tag Manager and Tracking
APIs and Webhooks
dbt - Fundamentals
AB Testing and Applied Statistics
Looker Studio (Google Data Studio)
Power BI - Fundamentals
SQL - Advanced Analytical Queries
Power BI - DAX and Advanced Dashboards
Python Analytics - Advanced Analysis and ML
Master Data Analytics for your next interview
Access all questions, flashcards, technical tests, code review exercises and interview simulators.
Start for free