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
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -367,6 +367,10 @@ def entrypoint(
367
367
)
368
368
```
369
369
370
+
!!! note
371
+
372
+
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.
373
+
370
374
## Examples
371
375
### Basic
372
376
The following is an example of a Python model returning a static Pandas DataFrame.
Copy file name to clipboardExpand all lines: docs/concepts/models/sql_models.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -175,6 +175,10 @@ SELECT
175
175
FROMcustomer2.some_source
176
176
```
177
177
178
+
!!! note
179
+
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.
181
+
178
182
## Python-based definition
179
183
180
184
The Python-based definition of SQL models consists of a single python function, decorated with SQLMesh's `@model`[decorator](https://wiki.python.org/moin/PythonDecorators). The decorator is required to have the `is_sql` keyword argument set to `True` to distinguish it from [Python models](./python_models.md) that return DataFrame instances.
The two models produced from this template are the same as in the [example](#SQL-model-blueprinting) for SQL-based blueprinting.
260
264
265
+
!!! note
266
+
267
+
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.
268
+
261
269
## Automatic dependencies
262
270
263
271
SQLMesh parses your SQL, so it understands what the code does and how it relates to other models. There is no need for you to manually specify dependencies to other models with special tags or commands.
0 commit comments