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