Overview - Built-in Jinja context variables
What is it?
Built-in Jinja context variables are special variables automatically available when writing Jinja code in dbt. They provide useful information about the current state, environment, or data being processed. These variables help you write dynamic and flexible SQL models by accessing metadata and runtime details. You don't need to define them; they come ready to use.
Why it matters
Without built-in Jinja context variables, you would have to manually pass or hardcode important information like the current model name, database, or execution environment. This would make your dbt projects less flexible and harder to maintain. These variables let you write smarter, reusable code that adapts automatically, saving time and reducing errors.
Where it fits
Before learning built-in Jinja context variables, you should understand basic Jinja templating and how dbt runs SQL models. After this, you can explore advanced dbt features like macros, hooks, and custom context variables to further customize your data transformations.