-
Notifications
You must be signed in to change notification settings - Fork 118
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
Empty transient tables #64
Comments
We are seeing the same issue and just arrived at this root cause today. We were thinking along the same lines of adjusting the incremental condition. Has that worked for y'all? |
@davidshapir I haven't had a chance to test this but am hoping to later this week - will let you know! |
@timothyjang123 - Sounds good! Can you share whatever macro or other operation you use in var_row_count if it ends up working? |
@timothyjang123 - I'm curious if making the template dynamic with
Note: this code is 100% untested, but I will try to look into this today. :) context: I'm @davidshapir's coworker. |
Hmm I think I see what you're saying - I haven't seen that article before and I'd have to test out the differences between dbt compile/run to see how the issue would work with the change mentioned. From what I read, I think it might have unexpected behavior (strange logs) but during execution it could work as expected - partly because the dependent view is just a saved query so it wouldn't have that same ref() issue mentioned in the article.
Regardless, I think the above is more precise for what we're trying to do - thanks @tommyh! FYI, I modified the above a bit for my own use in Snowflake. |
@timothyjang123 - the edgecase to test with
|
If the incremental table is empty, ie: `dim_dbt__models`, then `max(artifact-generated_at)` will be `NULL`, which means the `dbt_models_incremental` CTE will return 0 rows. brooklyn-data#64
I'm noticing some undesirable behavior for the incremental population of the transient tables.
Let's assume fct_dbt__test_executions doesn't get populated on a
dbt run dbt_artifacts
run, but gets created as a table with 0 records. Any subsequent run with how the incremental filter is setup like below is blocked from populating the table (which can easily happen if we only do model runs, without tests):The above will always be false since a null will be returned from the transient table. A fix may be as simple as adding another condition to is_incremental like below:
Where
var_row_count
is just a count of{{ this }}
. Might be overthinking this.. but it's strange when the incrementally populated table is empty while the view counterpart returns the current test executions.Any suggestions or insights?
The text was updated successfully, but these errors were encountered: