Skip to content

Commit

Permalink
update models
Browse files Browse the repository at this point in the history
  • Loading branch information
aspeddro committed May 24, 2024
1 parent 431db4c commit 2e8085d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
6 changes: 5 additions & 1 deletion models/br_inep_saeb/br_inep_saeb__brasil.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ select
safe_cast(lower(rede) as string) rede,
safe_cast(lower(localizacao) as string) localizacao,
safe_cast(disciplina as string) disciplina,
safe_cast(serie as int64) serie,
safe_cast(
case
when serie = "12" then "3" when serie = "13" then "4" else serie
end as int64
) serie,
safe_cast(media as float64) media,
safe_cast(nivel_0 as float64) nivel_0,
safe_cast(nivel_1 as float64) nivel_1,
Expand Down
12 changes: 8 additions & 4 deletions models/br_inep_saeb/br_inep_saeb__municipio.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@
alias="municipio",
schema="br_inep_saeb",
materialized="table",
labels={"tema": "educacao"},
labels={"project_id": "basedosdados-dev", "tema": "educacao"},
)
}}

select
safe_cast(ano as int64) ano,
safe_cast(rede as string) rede,
safe_cast(localizacao as string) localizacao,
safe_cast(lower(rede) as string) rede,
safe_cast(lower(localizacao) as string) localizacao,
safe_cast(sigla_uf as string) sigla_uf,
safe_cast(id_municipio as string) id_municipio,
safe_cast(disciplina as string) disciplina,
safe_cast(serie as int64) serie,
safe_cast(
case
when serie = "12" then "3" when serie = "13" then "4" else serie
end as int64
) serie,
round(safe_cast(media as float64), 2) media,
round(safe_cast(nivel_0 as float64), 2) nivel_0,
round(safe_cast(nivel_1 as float64), 2) nivel_1,
Expand Down
6 changes: 5 additions & 1 deletion models/br_inep_saeb/br_inep_saeb__uf.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ with
safe_cast(localizacao as string) localizacao,
safe_cast(sigla_uf as string) sigla_uf,
safe_cast(disciplina as string) disciplina,
safe_cast(serie as int64) serie,
safe_cast(
case
when serie = "12" then "3" when serie = "13" then "4" else serie
end as int64
) serie,
safe_cast(media as float64) media,
safe_cast(nivel_0 as float64) nivel_0,
safe_cast(nivel_1 as float64) nivel_1,
Expand Down

0 comments on commit 2e8085d

Please sign in to comment.