Skip to content
Tutorials Center
My learning

Topics

Lesson 41 of 41 ยท Projects and Practice

dbt Interview Questions and Answers

Prepare for analytics engineering interviews: 25 dbt questions and clear answers on models, tests, incremental logic, packages, deployment, CI and design.

dbt interviews tend to mix three things: whether you understand the model (SQL select statements built into a graph), whether you can reason about data quality and performance, and whether you work like an engineer (Git, CI, environments). This page gathers frequent questions with short, accurate answers. Use them to check your understanding, not to memorize: interviewers can tell the difference.

Fundamentals

What is dbt, and what does it not do? dbt compiles and runs SQL select statements as views and tables in a warehouse, adds testing, documentation and dependency management. It handles the "T" in ELT. It does not extract or load data, and it does not store data itself; the warehouse does the computing.

What is the difference between ref() and source()? source() points to raw tables loaded by other tools and defines them in YAML (with freshness and tests). ref() points to another dbt model. Both create edges in the DAG, and ref() resolves the right schema per environment.

What does dbt build do compared with dbt run? run builds models only. build runs seeds, models, snapshots and tests in dependency order and skips nodes downstream of a failure.

Explain the compile step. dbt renders Jinja (refs, macros, config) into plain SQL, written to target/compiled. The SQL that actually runs is in target/run, which includes the DDL wrapper such as create table ... as.

Models and materializations

View versus table versus ephemeral? A view stores the query (always fresh, slower to read), a table stores results (fast to read, stale until the next run), an ephemeral model is inlined as a CTE and creates nothing. See materializations.

When would you use an incremental model, and what are the risks? For large, mostly append-only tables that cannot be rebuilt quickly. Risks: late-arriving data skipped by a bad filter, duplicates without unique_key, drift that needs --full-refresh, and schema changes. See incremental basics.

What is unique_key for? It identifies rows so changed rows replace old versions (via merge or delete+insert) instead of creating duplicates.

Name incremental strategies. append, merge, delete+insert, insert_overwrite and microbatch; availability depends on the adapter. See strategies.

How do you handle late-arriving data? Filter on a load timestamp rather than event time, or reprocess a lookback window with a unique key, and schedule periodic full refreshes. See late data.

Testing and documentation

How does a dbt test work? It is a query returning failing rows; zero rows means pass. Generic tests are macros applied from YAML; singular tests are .sql files in tests/. See generic tests.

What are the built-in generic tests? unique, not_null, accepted_values and relationships.

How do you make a test warn instead of fail? config: {severity: warn}, or thresholds with warn_if and error_if. See severity.

How do you debug a failing test? Use store_failures to save the failing rows, or run the compiled test SQL from target/ directly in the warehouse.

What are doc blocks, and what is an exposure? Doc blocks are reusable Markdown descriptions referenced by doc(). An exposure declares a downstream consumer such as a dashboard so it appears in lineage. See docs and exposures.

Deployment and CI

How do you separate development and production? Targets in profiles.yml with different schemas (personal dev schemas, production schema), credentials from environment variables, and optionally a generate_schema_name override. See targets.

What is Slim CI? Building only changed models and descendants in a pull request with state:modified+, comparing with the production manifest, and --defer to read unbuilt parents from production. See CI.

How do you check that source data is fresh? Declare loaded_at_field and freshness on sources, and run dbt source freshness before the build.

How do you schedule dbt? dbt Cloud jobs, cron, CI schedulers, or an orchestrator such as Airflow or Dagster that triggers dbt after ingestion. See deploying.

What does dbt retry do? Reruns only failed or skipped nodes from the last invocation, using run_results.json.

Design and governance

How would you structure a project? Staging (one model per source table), intermediate (reusable logic), marts (facts and dimensions), with folder-level configs and naming conventions. See structure.

What are model contracts and versions? A contract enforces column names and types at build time. Versions let you ship a breaking change as v2 while v1 is deprecated. See contracts.

How do you speed up a slow dbt project? Find slow nodes in run_results.json; convert big rebuilds to incremental; select fewer columns and filter earlier; raise threads; reduce chains of views; use partitioning or clustering in the warehouse.

How do you test a refactor? Compare the old and new model's output with a data-diff approach such as audit_helper, and require the same tests to pass.

A SQL warm-up

Many interviews include a short SQL task along with dbt questions. Try a typical one: the top three customers by number of non-cancelled orders.

SQL Interview SQL: top customers ยท database: shop

Press Run (or Ctrl + Enter) to see the result here.

Another classic: a running total, which uses a window function and shows up in dbt marts constantly:

SQL Interview SQL: running revenue ยท database: shop

Press Run (or Ctrl + Enter) to see the result here.

How to answer well

  • Start with the idea in one sentence, then give an example from your own work.
  • Name trade-offs (views are fresh but slow; tables are fast but stale).
  • Say what you would test or monitor: interviewers value people who think about failure.
  • Admit what you do not know, and say how you would find out.

Check your understanding

Quick check ยท 3 questions

of 3 answered You scored / 3 ยท perfect!

  1. 1. What is the difference between dbt run and dbt build?

    build is a superset that includes tests and stops downstream nodes after failures.
  2. 2. Which is a good answer to 'how do you handle late data in an incremental model'?

    It captures late rows without duplicating them and repairs drift.
  3. 3. What does dbt not do?

    dbt is the T in ELT; ingestion is done by other tools.

Summary

  • Interviews check the dbt model, data quality thinking and engineering habits.
  • Explain ideas briefly, with trade-offs and examples.
  • Be ready to write SQL, including joins, aggregations and window functions.
  • Revisit the lessons linked above for any answer that felt weak.

Next: Back to the dbt course overview