Skip to content

Commit

Permalink
feat: re insert materialization logic
Browse files Browse the repository at this point in the history
  • Loading branch information
folhesgabriel committed Sep 11, 2024
1 parent d5d7af6 commit 89344e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion models/br_ms_sia/br_ms_sia__producao_ambulatorial.sql
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ select *
from sia

{% if is_incremental() %}
where date(cast(ano as int64), cast(mes as int64), 1) > date(2024, 3, 1)
where
date(cast(ano as int64), cast(mes as int64), 1)
> (select max(date(cast(ano as int64), cast(mes as int64), 1)) from {{ this }})

{% endif %}
4 changes: 3 additions & 1 deletion models/br_ms_sia/br_ms_sia__psicossocial.sql
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,7 @@ select
safe_cast(qtdpcn as string) quantidade_pacientes,
from sia_add_municipios as t
{% if is_incremental() %}
where date(cast(ano as int64), cast(mes as int64), 1) > date(2024, 3, 1)
where
date(cast(ano as int64), cast(mes as int64), 1)
> (select max(date(cast(ano as int64), cast(mes as int64), 1)) from {{ this }})
{% endif %}

0 comments on commit 89344e3

Please sign in to comment.