0
0
dbtdata~5 mins

Built-in Jinja context variables in dbt - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of built-in Jinja context variables in dbt?
Built-in Jinja context variables provide useful information and tools automatically available inside dbt models and macros to help you write dynamic SQL and control logic.
Click to reveal answer
beginner
What does the this variable represent in dbt's Jinja context?
this refers to the current model or resource being compiled, including its database, schema, and identifier. It helps build fully qualified table names.
Click to reveal answer
intermediate
How can the config variable be used in dbt models?
config allows you to set model configurations dynamically inside your SQL or macros, such as materialization type or tags.
Click to reveal answer
intermediate
Explain the use of the var variable in dbt Jinja context.
var lets you access user-defined variables passed from the command line or dbt_project.yml, enabling parameterized models.
Click to reveal answer
intermediate
What information does the target variable provide in dbt?
target contains details about the current environment like database, schema, and type of connection, useful for environment-specific logic.
Click to reveal answer
Which built-in Jinja variable in dbt gives you the current model's full name including database and schema?
Athis
Bvar
Cconfig
Dtarget
How do you access user-defined variables passed to dbt models?
Ausing var
Busing target
Cusing this
Dusing config
Which variable would you use to write environment-specific logic in dbt?
Athis
Btarget
Cvar
Dconfig
What is the main use of the config variable in dbt models?
ATo access environment variables
BTo get the current model name
CTo set model configurations dynamically
DTo pass user variables
True or False: The this variable can be used to build fully qualified table names.
AOnly in tests
BFalse
COnly in macros
DTrue
Describe the role of the built-in Jinja context variables this, var, and target in dbt.
Think about how these variables help customize SQL based on model and environment.
You got /3 concepts.
    How can the config variable be used to change model behavior in dbt?
    Consider how you might want to change how a model runs without changing the whole project.
    You got /3 concepts.