-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Cannot --defer
from --state
for microbatch
incremental strategy
#11128
Comments
Here's the log output from a model which is not configured as
|
--defer
from --state
for microbatch
incremental strategy
Thanks for reaching out @vvaneecloo ! I wasn't able to reproduce this when I tried it out in Project files and commandsCreate these files:
{{ config(materialized="view", event_time="event_occured_at") }}
{# -- Create 5 days of data #}
{% for i in range(1, 5) %}
select
{{ dbt.dateadd(
datepart="day",
interval=(-1 * i),
from_date_or_timestamp=dbt.current_timestamp()
) }} as event_occured_at,
{{ i % 2 }} as id {# -- Alternate between two ids: 0 and 1 #}
{% if not loop.last %} union all{% endif %}
{% endfor %}
{{
config(
materialized='incremental',
incremental_strategy='microbatch',
unique_key='id',
event_time='event_occured_at',
batch_size='day',
lookback=3,
begin='9999-12-30',
full_refresh=false,
)
}}
select *
from {{ ref('events') }} Run these commands: dbt build --target prod --select events
dbt parse --target prod --target-path prod_manifests
dbt show --inline "select * from {{ ref('events') }}"
dbt run -s my_microbatch_model --event-time-start "2024-12-01" --event-time-end "2024-12-08" --defer --state prod_manifests (The I got this output with everything working as expected:
|
Hey @dbeatty10, thanks for your comprehensive answer! Will definitely test this week & get back to you as soon as possible :) |
Is this a new bug in dbt-core?
Current Behavior
Using the
--defer
flag with themicrobatch
incremental strategy do not work even though the--defer
flag works with other models.Expected Behavior
I would expect the model to work like any other model with the
--defer
flag.Steps To Reproduce
dbt run -s fact_weekly_sales_and_stock --event-time-start "2024-12-01" --event-time-end "2024-12-08" --defer --state prod_manifests
i.e. I defer from prodHere's the highlighted error:
I think that even though the sql is generated, it fails to take into account the prod path instead of the dev path
Relevant log output
Environment
Which database adapter are you using with dbt?
spark // databricks
Additional Context
No response
The text was updated successfully, but these errors were encountered: