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

[fix] br_ibge_ #526

Merged
merged 2 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion models/br_ibge_ipca/br_ibge_ipca__mes_brasil.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
12 changes: 10 additions & 2 deletions models/br_ibge_ipca/br_ibge_ipca__mes_categoria_brasil.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@
],
)
}}
select


with
drop_duplicates as (
select distinct *
from `basedosdados-staging.br_ibge_ipca_staging.mes_categoria_brasil`
)

select distinct
safe_cast(ano as int64) ano,
safe_cast(mes as int64) mes,
safe_cast(id_categoria as string) id_categoria,
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down
8 changes: 7 additions & 1 deletion models/br_ibge_ipca/br_ibge_ipca__mes_categoria_rm.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down
8 changes: 7 additions & 1 deletion models/br_ibge_ipca15/br_ibge_ipca15__mes_brasil.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down
9 changes: 8 additions & 1 deletion models/br_ibge_ipca15/br_ibge_ipca15__mes_categoria_rm.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down
Loading