Skip to content

Commit 5dd460e

Browse files
authored
Update links to macro docs (#923)
1 parent ea01682 commit 5dd460e

8 files changed

Lines changed: 9 additions & 9 deletions

File tree

docs/concepts/architecture/serialization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Serialization
22

3-
SQLMesh executes Python code through [macros](../macros.md) and [Python models](../../concepts/models/python_models.md). Each Python model is stored as a standalone [snapshot](../architecture/snapshots.md), which includes all of the Python code necessary to generate it.
3+
SQLMesh executes Python code through [macros](../macros/overview.md) and [Python models](../../concepts/models/python_models.md). Each Python model is stored as a standalone [snapshot](../architecture/snapshots.md), which includes all of the Python code necessary to generate it.
44

55
## Serialization format
66

docs/concepts/audits.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ AUDIT (
4242
SELECT * FROM @this_model
4343
WHERE @column >= @threshold;
4444
```
45-
In the example above we utilized [macros](macros.md) to parameterize the audit implementation. `@this_model` is a special macro which refers to a model that is being audited. For incremental models, this macro also ensures that only relevant data intervals are affected. `@column` and `@threshold` are generic parameters, values for which are set in the model definition.
45+
In the example above we utilized [macros](./macros/overview.md) to parameterize the audit implementation. `@this_model` is a special macro which refers to a model that is being audited. For incremental models, this macro also ensures that only relevant data intervals are affected. `@column` and `@threshold` are generic parameters, values for which are set in the model definition.
4646

4747
The generic audit can now be applied to a model by being referenced in its definition:
4848
```sql linenums="1"

docs/concepts/models/model_kinds.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Only missing time intervals are processed during each execution for `INCREMENTAL
1010

1111
An `INCREMENTAL_BY_TIME_RANGE` model query must contain an expression in its SQL `WHERE` clause that filters the upstream records by time range. SQLMesh provides special macros that represent the start and end of the time range being processed: `@start_date` / `@end_date` and `@start_ds` / `@end_ds`.
1212

13-
Refer to [Macros](../macros.md#predefined-variables) for more information.
13+
Refer to [Macros](../macros/macro_variables.md) for more information.
1414

1515
This example implements an `INCREMENTAL_BY_TIME_RANGE` model by specifying the `kind` in the `MODEL` ddl and including a SQL `WHERE` clause to filter records by time range:
1616
```sql linenums="1" hl_lines="3-5 12-13"

docs/concepts/models/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ For models that are incremental, the following parameters can be specified in th
112112
- Batch size is used to optimize backfilling incremental data. It determines the maximum number of intervals to run in a single job. For example, if a model specifies a cron of `@hourly` and a batch_size of `12`, when backfilling 3 days of data, the scheduler will spawn 6 jobs. (3 days * 24 hours/day = 72 hour intervals to fill. 72 intervals / 12 intervals per job = 6 jobs.)
113113

114114
## Macros
115-
Macros can be used for passing in parameterized arguments such as dates, as well as for making SQL less repetitive. By default, SQLMesh provides several predefined macro variables that can be used. Macros are used by prefixing with the `@` symbol. For more information, refer to [macros](../macros.md).
115+
Macros can be used for passing in parameterized arguments such as dates, as well as for making SQL less repetitive. By default, SQLMesh provides several predefined macro variables that can be used. Macros are used by prefixing with the `@` symbol. For more information, refer to [macros](../macros/overview.md).
116116

117117
## Statements
118118
Models can have additional statements that run before the main query. This can be useful for loading things such as [UDFs](../glossary.md#user-defined-function-udf).

docs/concepts/models/sql_models.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,6 @@ You can also use advanced syntax that may not be available in your engine of cho
9292
Additionally, you won't have to worry about minor formatting differences such as trailing commas, as SQLGlot will remove them at parse time.
9393

9494
## Macros
95-
Although standard SQL is very powerful, complex data systems often require running SQL queries with dynamic components such as date filters. For example, you may want to change the date ranges in a `between` statement so that you can get the latest batch of data. SQLMesh provides these dates automatically through [macro variables](../macros.md#variables).
95+
Although standard SQL is very powerful, complex data systems often require running SQL queries with dynamic components such as date filters. For example, you may want to change the date ranges in a `between` statement so that you can get the latest batch of data. SQLMesh provides these dates automatically through [macro variables](../macros/macro_variables.md).
9696

97-
Additionally, large queries can be difficult to read and maintain. In order to make queries more compact, SQLMesh supports a powerful [macro syntax](../macros.md) as well as [Jinja](https://jinja.palletsprojects.com/en/3.1.x/), allowing you to write macros that make your SQL queries easier to manage.
97+
Additionally, large queries can be difficult to read and maintain. In order to make queries more compact, SQLMesh supports a powerful [macro syntax](../macros/overview.md) as well as [Jinja](https://jinja.palletsprojects.com/en/3.1.x/), allowing you to write macros that make your SQL queries easier to manage.

docs/concepts/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ In contrast to tests, SQLMesh "audits" validate the results of model code applie
5959

6060
You create audits by writing SQL queries that should return 0 rows. For example, an audit query to ensure `your_field` has no `NULL` values would include `WHERE your_field IS NULL`. If any NULLs are detected, the query will return at least one row and the audit will fail.
6161

62-
Audits are flexible — they can be tied to a specific model's contents, or you can use [macros](macros.md) to create audits that are usable by multiple models. SQLMesh also includes pre-made audits for common use cases, such as detecting NULL or duplicated values.
62+
Audits are flexible — they can be tied to a specific model's contents, or you can use [macros](./macros/overview.md) to create audits that are usable by multiple models. SQLMesh also includes pre-made audits for common use cases, such as detecting NULL or duplicated values.
6363

6464
You specify which audits should run for a model by including them in the model's metadata properties.
6565

docs/integrations/dbt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ For example, the SQL `WHERE` clause with the "ds" column goes in a new jinja blo
8888
> {% endif %}
8989
```
9090
91-
`{{ start_ds }}` and `{{ end_ds }}` are the jinja equivalents of SQLMesh's `@start_ds` and `@end_ds` predefined time macro variables. See all [predefined time variables](../concepts/macros.md#predefined-variables) available in jinja.
91+
`{{ start_ds }}` and `{{ end_ds }}` are the jinja equivalents of SQLMesh's `@start_ds` and `@end_ds` predefined time macro variables. See all [predefined time variables](../concepts/macros/macro_variables.md) available in jinja.
9292
9393
### Incremental model configuration
9494

docs/quick_start.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ This will create the directories and files that you can use to organize your SQL
3434
- ./tests
3535
- Unit test files. Refer to [testing](concepts/tests.md).
3636
- ./macros
37-
- Macro files. Refer to [macros](concepts/macros.md).
37+
- Macro files. Refer to [macros](concepts/macros/overview.md).
3838

3939
## 2. Plan and apply environments
4040
### 2.1 Create a prod environment

0 commit comments

Comments
 (0)