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: sqlmesh_dbt/operations.py
+10-8Lines changed: 10 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -113,15 +113,17 @@ def _plan_options(
113
113
# this results in the full scope of changes vs prod always being shown on the local branch
114
114
create_from=c.PROD,
115
115
always_recreate_environment=True,
116
-
# setting enable_preview=None enables dev previews of forward_only changes for dbt projects IF the target engine supports cloning
117
-
# if we set enable_preview=True here, this enables dev previews in all cases.
118
-
# In the case of dbt default INCREMENTAL_UNMANAGED models, this will cause incremental models to be fully rebuilt (potentially a very large computation)
119
-
# just to have the results thrown away on promotion to prod because dev previews are not promotable.
116
+
# Always enable dev previews for incremental / forward-only models.
117
+
# Due to how DBT does incrementals (INCREMENTAL_UNMANAGED on the SQLMesh engine), this will result in the full model being refreshed
118
+
# with the entire dataset, which can potentially be very large. If this is undesirable, users have two options:
119
+
# - work around this using jinja to conditionally add extra filters to the WHERE clause or a LIMIT to the model query
120
+
# - upgrade to SQLMesh's incremental models, where we have variables for the start/end date and inject leak guards to
121
+
# limit the amount of data backfilled
120
122
#
121
-
# TODO: if the user "upgrades" to an INCREMENTAL_BY_TIME_RANGE by defining a "time_column", we can inject leak guards to compute
122
-
# just a preview instead of the whole thing like we would in a native project, but the enable_preview setting is at the plan level
123
-
# and not the individual model level so we currently have no way of doing this selectively
124
-
enable_preview=None,
123
+
# Note: enable_preview=True is *different* behaviour to the `sqlmesh` CLI, which uses enable_preview=None.
124
+
# This means the `sqlmesh` CLI will only enable dev previews for dbt projects if the target adapter supports cloning,
0 commit comments