diff --git a/models/br_ibge_ipca/br_ibge_ipca__mes_brasil.sql b/models/br_ibge_ipca/br_ibge_ipca__mes_brasil.sql index 04f7b760..d6c8242b 100644 --- a/models/br_ibge_ipca/br_ibge_ipca__mes_brasil.sql +++ b/models/br_ibge_ipca/br_ibge_ipca__mes_brasil.sql @@ -10,6 +10,11 @@ ], ) }} + +with + drop_duplicates as ( + select distinct * from `basedosdados-staging.br_ibge_ipca_staging.mes_brasil` + ) select safe_cast(ano as int64) ano, safe_cast(mes as int64) mes, @@ -19,7 +24,7 @@ select safe_cast(variacao_semestral as float64) variacao_semestral, safe_cast(variacao_anual as float64) variacao_anual, safe_cast(variacao_doze_meses as float64) variacao_doze_meses -from `basedosdados-staging.br_ibge_ipca_staging.mes_brasil` as t +from drop_duplicates as t {% if is_incremental() %} where diff --git a/models/br_ibge_ipca/br_ibge_ipca__mes_categoria_brasil.sql b/models/br_ibge_ipca/br_ibge_ipca__mes_categoria_brasil.sql index 54847ee7..c19dbbcd 100644 --- a/models/br_ibge_ipca/br_ibge_ipca__mes_categoria_brasil.sql +++ b/models/br_ibge_ipca/br_ibge_ipca__mes_categoria_brasil.sql @@ -10,6 +10,14 @@ ], ) }} + + +with + drop_duplicates as ( + select distinct * + from `basedosdados-staging.br_ibge_ipca_staging.mes_categoria_brasil` + ) + select safe_cast(ano as int64) ano, safe_cast(mes as int64) mes, @@ -20,7 +28,7 @@ select safe_cast(variacao_mensal as float64) variacao_mensal, safe_cast(variacao_anual as float64) variacao_anual, safe_cast(variacao_doze_meses as float64) variacao_doze_meses -from `basedosdados-staging.br_ibge_ipca_staging.mes_categoria_brasil` as t +from drop_duplicates as t {% if is_incremental() %} where date(cast(ano as int64), cast(mes as int64), 1) diff --git a/models/br_ibge_ipca/br_ibge_ipca__mes_categoria_municipio.sql b/models/br_ibge_ipca/br_ibge_ipca__mes_categoria_municipio.sql index 75e57460..ea2a02cc 100644 --- a/models/br_ibge_ipca/br_ibge_ipca__mes_categoria_municipio.sql +++ b/models/br_ibge_ipca/br_ibge_ipca__mes_categoria_municipio.sql @@ -10,6 +10,12 @@ ], ) }} + +with + drop_duplicates as ( + select distinct * + from `basedosdados-staging.br_ibge_ipca_staging.mes_categoria_municipio` + ) select safe_cast(ano as int64) ano, safe_cast(mes as int64) mes, @@ -21,7 +27,7 @@ select safe_cast(variacao_mensal as float64) variacao_mensal, safe_cast(variacao_anual as float64) variacao_anual, safe_cast(variacao_doze_meses as float64) variacao_doze_meses -from `basedosdados-staging.br_ibge_ipca_staging.mes_categoria_municipio` as t +from drop_duplicates as t {% if is_incremental() %} where date(cast(ano as int64), cast(mes as int64), 1) diff --git a/models/br_ibge_ipca/br_ibge_ipca__mes_categoria_rm.sql b/models/br_ibge_ipca/br_ibge_ipca__mes_categoria_rm.sql index 908ec4e5..e1c3909f 100644 --- a/models/br_ibge_ipca/br_ibge_ipca__mes_categoria_rm.sql +++ b/models/br_ibge_ipca/br_ibge_ipca__mes_categoria_rm.sql @@ -11,6 +11,12 @@ ) }} + +with + drop_duplicates as ( + select distinct * + from `basedosdados-staging.br_ibge_ipca_staging.mes_categoria_rm` + ) select safe_cast(ano as int64) ano, safe_cast(mes as int64) mes, @@ -22,7 +28,7 @@ select safe_cast(variacao_mensal as float64) variacao_mensal, safe_cast(variacao_anual as float64) variacao_anual, safe_cast(variacao_doze_meses as float64) variacao_doze_meses -from `basedosdados-staging.br_ibge_ipca_staging.mes_categoria_rm` as t +from drop_duplicates as t {% if is_incremental() %} where date(cast(ano as int64), cast(mes as int64), 1) diff --git a/models/br_ibge_ipca15/br_ibge_ipca15__mes_brasil.sql b/models/br_ibge_ipca15/br_ibge_ipca15__mes_brasil.sql index 62e78a45..e87492e5 100644 --- a/models/br_ibge_ipca15/br_ibge_ipca15__mes_brasil.sql +++ b/models/br_ibge_ipca15/br_ibge_ipca15__mes_brasil.sql @@ -10,6 +10,12 @@ ], ) }} + + +with + drop_duplicates as ( + select distinct * from `basedosdados-staging.br_ibge_ipca15_staging.mes_brasil` + ) select safe_cast(ano as int64) ano, safe_cast(mes as int64) mes, @@ -19,7 +25,7 @@ select safe_cast(variacao_semestral as float64) variacao_semestral, safe_cast(variacao_anual as float64) variacao_anual, safe_cast(variacao_doze_meses as float64) variacao_doze_meses -from `basedosdados-staging.br_ibge_ipca15_staging.mes_brasil` as t +from drop_duplicates as t {% if is_incremental() %} where date(cast(ano as int64), cast(mes as int64), 1) diff --git a/models/br_ibge_ipca15/br_ibge_ipca15__mes_categoria_brasil.sql b/models/br_ibge_ipca15/br_ibge_ipca15__mes_categoria_brasil.sql index d67c0a6d..3d122336 100644 --- a/models/br_ibge_ipca15/br_ibge_ipca15__mes_categoria_brasil.sql +++ b/models/br_ibge_ipca15/br_ibge_ipca15__mes_categoria_brasil.sql @@ -10,6 +10,12 @@ ], ) }} + +with + drop_duplicates as ( + select distinct * + from `basedosdados-staging.br_ibge_ipca15_staging.mes_categoria_brasil` + ) select safe_cast(ano as int64) ano, safe_cast(mes as int64) mes, @@ -20,7 +26,7 @@ select safe_cast(variacao_mensal as float64) variacao_mensal, safe_cast(variacao_anual as float64) variacao_anual, safe_cast(variacao_doze_meses as float64) variacao_doze_meses -from `basedosdados-staging.br_ibge_ipca15_staging.mes_categoria_brasil` as t +from drop_duplicates as t {% if is_incremental() %} where date(cast(ano as int64), cast(mes as int64), 1) diff --git a/models/br_ibge_ipca15/br_ibge_ipca15__mes_categoria_municipio.sql b/models/br_ibge_ipca15/br_ibge_ipca15__mes_categoria_municipio.sql index 6d5431f4..9968bf0f 100644 --- a/models/br_ibge_ipca15/br_ibge_ipca15__mes_categoria_municipio.sql +++ b/models/br_ibge_ipca15/br_ibge_ipca15__mes_categoria_municipio.sql @@ -10,6 +10,12 @@ ], ) }} + +with + drop_duplicates as ( + select distinct * + from `basedosdados-staging.br_ibge_ipca15_staging.mes_categoria_municipio` + ) select safe_cast(ano as int64) ano, safe_cast(mes as int64) mes, @@ -21,7 +27,7 @@ select safe_cast(variacao_mensal as float64) variacao_mensal, safe_cast(variacao_anual as float64) variacao_anual, safe_cast(variacao_doze_meses as float64) variacao_doze_meses -from `basedosdados-staging.br_ibge_ipca15_staging.mes_categoria_municipio` as t +from drop_duplicates as t {% if is_incremental() %} where date(cast(ano as int64), cast(mes as int64), 1) diff --git a/models/br_ibge_ipca15/br_ibge_ipca15__mes_categoria_rm.sql b/models/br_ibge_ipca15/br_ibge_ipca15__mes_categoria_rm.sql index 9fdb6980..5390845d 100644 --- a/models/br_ibge_ipca15/br_ibge_ipca15__mes_categoria_rm.sql +++ b/models/br_ibge_ipca15/br_ibge_ipca15__mes_categoria_rm.sql @@ -10,6 +10,13 @@ ], ) }} + + +with + drop_duplicates as ( + select distinct * + from `basedosdados-staging.br_ibge_ipca15_staging.mes_categoria_rm` + ) select safe_cast(ano as int64) ano, safe_cast(mes as int64) mes, @@ -21,7 +28,7 @@ select safe_cast(variacao_mensal as float64) variacao_mensal, safe_cast(variacao_anual as float64) variacao_anual, safe_cast(variacao_doze_meses as float64) variacao_doze_meses -from `basedosdados-staging.br_ibge_ipca15_staging.mes_categoria_rm` as t +from drop_duplicates as t {% if is_incremental() %} where date(cast(ano as int64), cast(mes as int64), 1)