โ† All DBT Flashcard Decks

DBT Macros & Jinja Flashcards

6 cards from real DBT practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 6 DBT Macros & Jinja flashcards as text
  1. Which delimiter is used in Jinja to output a value in dbt SQL files?

    Answer: {{ ... }}

    `{{ }}` is the Jinja expression delimiter that evaluates and renders a value into the SQL output.

  2. What Jinja delimiter is used for control flow statements like `if`, `for`, and `set` in dbt?

    Answer: {% ... %}

    `{% %}` is used for Jinja statements such as `{% if %}`, `{% for %}`, and `{% set %}` which control logic without producing direct output.

  3. How do you define a reusable macro in dbt?

    Answer: Define it with {% macro name(args) %} ... {% endmacro %} in the macros/ folder

    Macros are defined with `{% macro macro_name(arg1) %}...{% endmacro %}` blocks stored in any `.sql` file inside the `macros/` directory.

  4. What built-in dbt variable returns the current target name (e.g., 'dev' or 'prod')?

    Answer: {{ target.name }}

    `{{ target.name }}` returns the name of the active target as defined in profiles.yml, commonly used to branch logic between environments.

  5. Which dbt Jinja function safely reads an environment variable and supports a default value?

    Answer: {{ env_var('VAR_NAME', 'default') }}

    `env_var('NAME', 'default')` reads a process environment variable and returns the default if the variable is not set.

  6. What does `{{ this }}` refer to inside a dbt model?

    Answer: The relation (schema.table) of the model currently being built

    `{{ this }}` is a special dbt variable that resolves to the fully qualified relation of the model being compiled, useful in incremental logic.

How this page was made: written with AI tools. We have not yet matched this exam's facts to an official source, so confirm fees, dates and rules with the exam body. Not reviewed by a subject-matter expert. Editorial policy