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
Enter the backfill end date (eg. '1 month ago', '2020-01-01') or blank to backfill up until'2024-09-27 00:00:00':
247
247
```
248
248
249
+
#### Minimum intervals
250
+
251
+
When you run a plan with a fixed `--start` or `--end` date, you create a virtual data environment with a limited subset of data. However, if the time range specified is less than the size of an interval on one of your models, that model will be skipped by default.
252
+
253
+
For example, if you have a model like so:
254
+
255
+
```sql
256
+
MODEL(
257
+
name sqlmesh_example.monthly_model,
258
+
kind INCREMENTAL_BY_TIME_RANGE (
259
+
time_column month
260
+
),
261
+
cron '@monthly'
262
+
);
263
+
264
+
SELECT SUM(a) AS sum_a, MONTH(day) AS month
265
+
FROM sqlmesh_example.upstream_model
266
+
WHERE day BETWEEN @start_ds AND @end_ds
267
+
```
268
+
269
+
make a change to it and run the following:
270
+
271
+
```bash linenums="1" hl_lines="8"
272
+
$ sqlmesh plan dev --start '1 day ago'
273
+
274
+
Models:
275
+
└── Added:
276
+
└── sqlmesh_example__dev.monthly_model
277
+
Apply - Virtual Update [y/n]: y
278
+
279
+
SKIP: No model batches to execute
280
+
```
281
+
282
+
No data will be backfilled because `1 day ago` does not contain a complete month. However, you can use the `--min-intervals` option to override this behaviour like so:
283
+
284
+
```bash linenums="1" hl_lines="11"
285
+
$ sqlmesh plan dev --start '1 day ago' --min-intervals 1
Executing model batches ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 1/1 • 0:00:00
294
+
295
+
✔ Model batches executed
296
+
```
297
+
298
+
This will ensure that regardless of the plan `--start` date, all added or modified models will have at least `--min-intervals` intervals considered for backfill.
299
+
300
+
!!! info
301
+
302
+
If you are running plans manually you can just adjust the `--start` date to be wide enough to cover the models in question.
303
+
304
+
The `--min-intervals` option is primarily intended for[automation scenarios](../integrations/github.md) where the plan is always run with a default relative start date and you always want (for example) "2 weeks worth of data"in the target environment.
305
+
249
306
### Data preview for forward-only changes
250
307
As mentioned earlier, the data output produced by [forward-only changes](#forward-only-change) in a development environment can only be used for preview and will not be reused in production.
Copy file name to clipboardExpand all lines: docs/integrations/github.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -294,6 +294,7 @@ Below is an example of how to define the default config for the bot in either YA
294
294
| `command_namespace` | The namespace to use for SQLMesh commands. For example if you provide `#SQLMesh` as a value then commands will be expected in the format of `#SQLMesh/<command>`. Default: `None` meaning no namespace is used. | string | N |
295
295
| `auto_categorize_changes` | Auto categorization behavior to use for the bot. If not provided then the project-wide categorization behavior is used. See [Auto-categorize model changes](https://sqlmesh.readthedocs.io/en/stable/guides/configuration/#auto-categorize-model-changes) for details. | dict | N |
296
296
| `default_pr_start` | Default start when creating PR environment plans. If running in a mode where the bot automatically backfills models (based on `auto_categorize_changes` behavior) then this can be used to limit the amount of data backfilled. Defaults to `None` meaning the start date is set to the earliest model's start or to 1 day ago if [data previews](../concepts/plans.md#data-preview) need to be computed. | str | N |
297
+
| `pr_min_intervals` | Intended for use when `default_pr_start` is set to a relative time, eg `1 week ago`. This ensures that at least this many intervals across every model are included for backfill in the PR environment. Without this, models with an interval unit wider than `default_pr_start` (such as `@monthly` models if `default_pr_start` was set to `1 week ago`) will be excluded from backfill entirely. | int | N |
297
298
| `skip_pr_backfill` | Indicates if the bot should skip backfilling models in the PR environment. Default: `True`| bool | N |
298
299
| `pr_include_unmodified` | Indicates whether to include unmodified models in the PR environment. Default to the project's config value (which defaults to `False`) | bool | N |
299
300
| `run_on_deploy_to_prod` | Indicates whether to run latest intervals when deploying to prod. If set to false, the deployment will backfill only the changed models up to the existing latest interval in production, ignoring any missing intervals beyond this point. Default: `False`| bool | N |
0 commit comments