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/models/python_models.md
+25-2Lines changed: 25 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -367,9 +367,32 @@ def entrypoint(
367
367
)
368
368
```
369
369
370
-
!!! note
370
+
Blueprint variable mappings can also be constructed dynamically, e.g., by using a macro: `blueprints="@gen_blueprints()"`. This is useful in cases where the `blueprints` list needs to be sourced from external sources, such as CSV files.
371
+
372
+
For example, the definition of the `gen_blueprints` may look like this:
Blueprint variable mappings can also be evaluated dynamically, by using a macro (i.e. `blueprints="@gen_blueprints()"`). This is useful in cases where the `blueprints` list needs to be sourced from external sources, e.g. CSV files.
385
+
It's also possible to use the `@EACH` macro, combined with a global list variable (`@values`):
386
+
387
+
```python linenums="1"
388
+
389
+
@model(
390
+
"@{customer}.some_table",
391
+
blueprints="@EACH(@values, x -> (customer := schema_@x))",
Copy file name to clipboardExpand all lines: docs/concepts/models/sql_models.md
+52-4Lines changed: 52 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -175,9 +175,33 @@ SELECT
175
175
FROMcustomer2.some_source
176
176
```
177
177
178
-
!!! note
178
+
Blueprint variable mappings can also be constructed dynamically, e.g., by using a macro: `blueprints @gen_blueprints()`. This is useful in cases where the `blueprints` list needs to be sourced from external sources, such as CSV files.
179
+
180
+
For example, the definition of the `gen_blueprints` may look like this:
It's also possible to use the `@EACH` macro, combined with a global list variable (`@values`):
179
194
180
-
Blueprint variable mappings can also be evaluated dynamically, by using a macro (i.e. `blueprints @gen_blueprints()`). This is useful in cases where the `blueprints` list needs to be sourced from external sources, e.g. CSV files.
195
+
```sql linenums="1"
196
+
MODEL (
197
+
name @customer.some_table,
198
+
kind FULL,
199
+
blueprints @EACH(@values, x -> (customer := schema_@x)),
The two models produced from this template are the same as in the [example](#SQL-model-blueprinting) for SQL-based blueprinting.
264
288
265
-
!!! note
289
+
Blueprint variable mappings can also be constructed dynamically, e.g., by using a macro: `blueprints="@gen_blueprints()"`. This is useful in cases where the `blueprints` list needs to be sourced from external sources, such as CSV files.
290
+
291
+
For example, the definition of the `gen_blueprints` may look like this:
Blueprint variable mappings can also be evaluated dynamically, by using a macro (i.e. `blueprints="@gen_blueprints()"`). This is useful in cases where the `blueprints` list needs to be sourced from external sources, e.g. CSV files.
304
+
It's also possible to use the `@EACH` macro, combined with a global list variable (`@values`):
305
+
306
+
```python linenums="1"
307
+
308
+
@model(
309
+
"@{customer}.some_table",
310
+
is_sql=True,
311
+
blueprints="@EACH(@values, x -> (customer := schema_@x))",
0 commit comments