You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/concepts/macros/jinja_macros.md
+25Lines changed: 25 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -122,6 +122,31 @@ Access gateway variables in models using the same methods as [global variables](
122
122
123
123
Gateway-specific variable values take precedence over variables with the same name specified in the configuration file's root `variables` key.
124
124
125
+
### Blueprint variables
126
+
127
+
Blueprint variables are defined as a property of the `MODEL` statement, and serve as a mechanism for [creating model templates](../models/sql_models.md):
{{ blueprint_var('field_b', 'default_b') }} AS field_b
143
+
FROM {{ blueprint_var('customer') }}.some_source
144
+
JINJA_END;
145
+
```
146
+
147
+
Blueprint variables can be accessed using the `{{ blueprint_var() }}` macro function, which also supports specifying default values in case the variable is undefined (similar to `{{ var() }}`).
148
+
149
+
125
150
### Local variables
126
151
127
152
Define your own variables with the Jinja statement `{% set ... %}`. For example, we could specify the name of the `num_orders` column in the `sqlmesh_example.full_model` like this:
0 commit comments