Skip to content

Commit

Permalink
fix: censo_2022 tables
Browse files Browse the repository at this point in the history
  • Loading branch information
laura-l-amaral committed Nov 7, 2024
1 parent 0ba1f29 commit 4f3308e
Show file tree
Hide file tree
Showing 59 changed files with 921 additions and 2,212 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{
config(
alias="alfabetizacao_grupo_idade_sexo_raca",
schema="br_ibge_censo_2022",
)
}}
select
safe_cast(municipio_codigo_ as string) id_municipio,
safe_cast(cor_ou_raca as string) cor_raca,
safe_cast(sexo as string) sexo,
safe_cast(idade as string) grupo_idade,
safe_cast(alfabetizacao as string) alfabetizacao,
safe_cast(valor as int64) populacao,
from
`basedosdados-staging.br_ibge_censo_2022_staging.alfabetizacao_grupo_idade_sexo_raca`
as t

This file was deleted.

Empty file.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{{
config(
alias="morador_cor_raca_destino_lixo_municipio", schema="br_ibge_censo_2022"
alias="caracteristica_domicilio_grupo_idade_raca_destino_lixo",
schema="br_ibge_censo_2022",
)
}}
select
Expand All @@ -11,7 +12,7 @@ select
safe_cast(cor_ou_raca as string) cor_raca,
safe_cast(
moradores_em_domicilios_particulares_permanentes_ocupados_pessoas_ as int64
) moradores,
) populacao,
from
`basedosdados-staging.br_ibge_censo_2022_staging.morador_cor_raca_destino_lixo_municipio`
`basedosdados-staging.br_ibge_censo_2022_staging.caracteristica_domicilio_grupo_idade_raca_destino_lixo`
as t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{
config(
alias="morador_cor_raca_esgotamento_sanitario_municipio",
alias="caracteristica_domicilio_grupo_idade_raca_esgotamento_sanitario",
schema="br_ibge_censo_2022",
)
}}
Expand All @@ -12,7 +12,7 @@ select
safe_cast(cor_ou_raca as string) cor_raca,
safe_cast(
moradores_em_domicilios_particulares_permanentes_ocupados_pessoas_ as int64
) moradores,
) populacao,
from
`basedosdados-staging.br_ibge_censo_2022_staging.morador_cor_raca_esgotamento_sanitario_municipio`
`basedosdados-staging.br_ibge_censo_2022_staging.caracteristica_domicilio_grupo_idade_raca_esgotamento_sanitario`
as t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{
config(
alias="morador_cor_raca_ligacao_abastecimento_agua_municipio",
alias="caracteristica_domicilio_grupo_idade_raca_ligacao_abastecimento_agua",
schema="br_ibge_censo_2022",
)
}}
Expand All @@ -15,7 +15,7 @@ select
safe_cast(cor_ou_raca as string) cor_raca,
safe_cast(
moradores_em_domicilios_particulares_permanentes_ocupados_pessoas_ as int64
) moradores,
) populacao,
from
`basedosdados-staging.br_ibge_censo_2022_staging.morador_cor_raca_ligacao_abastecimento_agua_municipio`
`basedosdados-staging.br_ibge_censo_2022_staging.caracteristica_domicilio_grupo_idade_raca_ligacao_abastecimento_agua`
as t
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{{
config(
alias="morador_cor_raca_tipo_domicilio_municipio",
alias="caracteristica_domicilio_grupo_idade_raca_tipo_domicilio",
schema="br_ibge_censo_2022",
tag=["refazer"],
)
}}
select
Expand All @@ -12,7 +13,7 @@ select
safe_cast(cor_ou_raca as string) cor_raca,
safe_cast(
moradores_em_domicilios_particulares_permanentes_ocupados_pessoas_ as int64
) moradores,
) populacao,
from
`basedosdados-staging.br_ibge_censo_2022_staging.morador_cor_raca_tipo_domicilio_municipio`
`basedosdados-staging.br_ibge_censo_2022_staging.caracteristica_domicilio_grupo_idade_raca_tipo_domicilio`
as t

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{{
config(
alias="domicilio_recenseado_especie_municipio", schema="br_ibge_censo_2022"
)
}}
{{ config(alias="domicilio_recenseado", schema="br_ibge_censo_2022") }}
with
ibge as (
select
Expand All @@ -15,12 +11,10 @@ with
) sigla_uf,
safe_cast(especie as string) especie,
safe_cast(domicilios_recenseados_domicilios_ as int64) domicilios,
from
`basedosdados-staging.br_ibge_censo_2022_staging.domicilio_recenseado_especie_municipio`
as t
from `basedosdados-staging.br_ibge_censo_2022_staging.domicilio_recenseado` as t
)
select t2.cod as id_municipio, ibge.* except (municipio, nome_municipio, sigla_uf)
from ibge
left join
`basedosdados-dev.br_ibge_censo_2022_staging.auxiliary_table` t2
`basedosdados-staging.br_ibge_censo_2022_staging.auxiliary_table` t2
on ibge.municipio = t2.municipio

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{{
config(
alias="indice_envelhecimento_cor_raca_municipio", schema="br_ibge_censo_2022"
)
}}
{{ config(alias="indice_envelhecimento_raca", schema="br_ibge_censo_2022") }}
select
safe_cast(ano as int64) ano,
safe_cast(cod_ as string) id_municipio,
Expand All @@ -14,5 +10,4 @@ select
) indice_envelhecimento,
safe_cast(idade_mediana_anos_ as int64) idade_mediana,
safe_cast(replace(razao_de_sexo_razao_, ",", ".") as float64) razao_sexo,
from
`basedosdados-staging.br_ibge_censo_2022_staging.indice_envelhecimento_cor_raca_municipio` t
from `basedosdados-staging.br_ibge_censo_2022_staging.indice_envelhecimento_raca` t

This file was deleted.

This file was deleted.

Loading

0 comments on commit 4f3308e

Please sign in to comment.