Skip to content
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

Make Satellite HWM safe against outside truncate #74

Open
tkirschke opened this issue Jun 2, 2023 · 3 comments
Open

Make Satellite HWM safe against outside truncate #74

tkirschke opened this issue Jun 2, 2023 · 3 comments

Comments

@tkirschke
Copy link
Member

In All Kinds of Satellites there is a HWM logic applied for incremental runs. This logic checks

WHERE ldts > (SELECT max(ldts) FROM {{ this }})

But for cases, where this table is truncated outside of dbt, SELECT max(ldts) would return NULL, and on some databases the comparison ldts > NULL throws an error.

To avoid this, we need to insert the beginning-of-all-times for cases when max(ldts) returns NULL, like this:

WHERE ldts > (SELECT COALESCE(max(ldts), {{ datavault4dbt.beginning_of_all_times() }}) FROM {{ this }})

Thanks to

for pointing out this issue and proposing a solution!

@bschlottfeldt bschlottfeldt self-assigned this Jan 11, 2024
@bschlottfeldt
Copy link
Contributor

COALESCE(MAX({{ src_ldts }}),{{ datavault4dbt.string_to_timestamp(timestamp_format, beginning_of_all_times) }})

Copy link

github-actions bot commented Jul 8, 2024

This issue is stale because it has been open for 90 days with no activity. If you would like the issue to remain open, please remove the stale label or comment on the issue. Otherwise it will be closed in 14 days

@tkirschke
Copy link
Member Author

check all macros and apply this to all that use a HWM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants