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

[dbt]: update br_ibge_censo_2022 #467

Merged
merged 7 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ models/*/tmp/
models/*/input/
models/*/output/
models/*/extra/
venv*
3 changes: 0 additions & 3 deletions dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ config-version: 2

# This setting configures which "profile" dbt uses for this project.
profile: default

# Options to disable elementary models
vars:
disable_run_results: false
disable_tests_results: false
disable_dbt_artifacts_autoupload: false
disable_dbt_invocation_autoupload: false

# These configurations specify where dbt should look for different types of files.
# The `source-paths` config, for example, states that models in this project can be
# found in the "models/" directory. You probably won't need to change these!
Expand All @@ -29,7 +27,6 @@ target-path: target # directory which will store compiled SQL files
clean-targets: # directories to be removed by `dbt clean`
- target
- dbt_modules

# Grant acess
# bq data control: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-control-language
# dbt grant statements use https://discourse.getdbt.com/t/the-exact-grant-statements-we-use-in-a-dbt-project/430
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{
config(
alias="domicilio_canalizacao_abastecimento_agua_municipio",
schema="br_ibge_censo_2022",
)
}}
select
safe_cast(ano as int64) ano,
safe_cast(cod_ as string) id_municipio,
safe_cast(
principal_forma_de_abastecimento_de_agua as string
) tipo_abastecimento_agua,
safe_cast(existencia_de_canalizacao_de_agua as string) tipo_canalizacao_agua,
safe_cast(
domicilios_particulares_permanentes_ocupados_unidades_ as int64
) domicilios,
from
`basedosdados-staging.br_ibge_censo_2022_staging.domicilio_canalizacao_abastecimento_agua_municipio`
as t
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{ config(alias="domicilio_destino_lixo_municipio", schema="br_ibge_censo_2022") }}
select
safe_cast(replace(ano, ".0", "") as int64) ano,
safe_cast(cod_ as string) id_municipio,
safe_cast(destino_do_lixo as string) tipo_destino_lixo,
safe_cast(
domicilios_particulares_permanentes_ocupados_unidades_ as int64
) domicilios,
from
`basedosdados-staging.br_ibge_censo_2022_staging.domicilio_destino_lixo_municipio`
as t
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{
config(
alias="domicilio_esgotamento_sanitario_municipio",
schema="br_ibge_censo_2022",
)
}}
select
safe_cast(ano as int64) ano,
safe_cast(cod_ as string) id_municipio,
safe_cast(tipo_de_esgotamento_sanitario as string) tipo_esgotamento_sanitario,
safe_cast(
domicilios_particulares_permanentes_ocupados_unidades_ as int64
) domicilios,
from
`basedosdados-staging.br_ibge_censo_2022_staging.domicilio_esgotamento_sanitario_municipio`
as t
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{
config(
alias="domicilio_ligacao_abastecimento_agua_municipio",
schema="br_ibge_censo_2022",
)
}}
select
safe_cast(ano as int64) ano,
safe_cast(cod_ as string) id_municipio,
safe_cast(
existencia_de_ligacao_a_rede_geral_de_distribuicao_de_agua_e_principal_forma_de_abastecimento_de_agua
as string
) tipo_ligacao_rede_geral,
safe_cast(
domicilios_particulares_permanentes_ocupados_unidades_ as int64
) domicilios,
from
`basedosdados-staging.br_ibge_censo_2022_staging.domicilio_ligacao_abastecimento_agua_municipio`
as t
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{
config(
alias="domicilio_quantidade_esgotamento_sanitario_municipio",
schema="br_ibge_censo_2022",
)
}}
select
safe_cast(ano as int64) ano,
safe_cast(cod_ as string) id_municipio,
safe_cast(tipo_de_esgotamento_sanitario as string) tipo_esgotamento_sanitario,
safe_cast(
existencia_de_banheiro_ou_sanitario_e_numero_de_banheiros_de_uso_exclusivo_do_domicilio
as string
) tipo_quantidade_banheiro,
safe_cast(
domicilios_particulares_permanentes_ocupados_unidades_ as int64
) domicilios,
from
`basedosdados-staging.br_ibge_censo_2022_staging.domicilio_quantidade_esgotamento_sanitario_municipio`
as t
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{ config(alias="domicilio_tipo_municipio", schema="br_ibge_censo_2022") }}
select
safe_cast(ano as int64) ano,
safe_cast(cod_ as string) id_municipio,
safe_cast(tipo_de_domicilio as string) tipo_domicilio,
safe_cast(
domicilios_particulares_permanentes_ocupados_unidades_ as int64
) domicilios,
from `basedosdados-staging.br_ibge_censo_2022_staging.domicilio_tipo_municipio` as t
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{
config(
alias="morador_cor_raca_destino_lixo_municipio", schema="br_ibge_censo_2022"
)
}}
select
safe_cast(ano as int64) ano,
safe_cast(cod_ as string) id_municipio,
safe_cast(destino_do_lixo as string) tipo_destino_lixo,
safe_cast(grupo_de_idade as string) grupo_idade,
safe_cast(cor_ou_raca as string) cor_raca,
safe_cast(
moradores_em_domicilios_particulares_permanentes_ocupados_pessoas_ as int64
) moradores,
from
`basedosdados-staging.br_ibge_censo_2022_staging.morador_cor_raca_destino_lixo_municipio`
as t
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{
config(
alias="morador_cor_raca_esgotamento_sanitario_municipio",
schema="br_ibge_censo_2022",
)
}}
select
safe_cast(ano as int64) ano,
safe_cast(cod_ as string) id_municipio,
safe_cast(tipo_de_esgotamento_sanitario as string) tipo_esgotamento_sanitario,
safe_cast(grupo_de_idade as string) grupo_idade,
safe_cast(cor_ou_raca as string) cor_raca,
safe_cast(
moradores_em_domicilios_particulares_permanentes_ocupados_pessoas_ as int64
) moradores,
from
`basedosdados-staging.br_ibge_censo_2022_staging.morador_cor_raca_esgotamento_sanitario_municipio`
as t
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{
config(
alias="morador_cor_raca_ligacao_abastecimento_agua_municipio",
schema="br_ibge_censo_2022",
)
}}
select
safe_cast(ano as int64) ano,
safe_cast(cod_ as string) id_municipio,
safe_cast(
existencia_de_ligacao_a_rede_geral_de_distribuicao_de_agua_e_principal_forma_de_abastecimento_de_agua
as string
) tipo_ligacao_rede_geral,
safe_cast(grupo_de_idade as string) grupo_idade,
safe_cast(cor_ou_raca as string) cor_raca,
safe_cast(
moradores_em_domicilios_particulares_permanentes_ocupados_pessoas_ as int64
) moradores,
from
`basedosdados-staging.br_ibge_censo_2022_staging.morador_cor_raca_ligacao_abastecimento_agua_municipio`
as t
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{
config(
alias="morador_cor_raca_tipo_domicilio_municipio",
schema="br_ibge_censo_2022",
)
}}
select
safe_cast(ano as int64) ano,
safe_cast(cod_ as string) id_municipio,
safe_cast(tipo_de_domicilio as string) tipo_domicilio,
safe_cast(grupo_de_idade as string) grupo_idade,
safe_cast(cor_ou_raca as string) cor_raca,
safe_cast(
moradores_em_domicilios_particulares_permanentes_ocupados_pessoas_ as int64
) moradores,
from
`basedosdados-staging.br_ibge_censo_2022_staging.morador_cor_racao_tipo_domicilio_municipio`
as t
Loading
Loading