-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fixing-the-dictionarys
- Loading branch information
Showing
17 changed files
with
1,095 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 0 additions & 60 deletions
60
models/br_bd_diretorios_brasil/br_bd_diretorios_brasil__setor_censitario.sql
This file was deleted.
Oops, something went wrong.
47 changes: 47 additions & 0 deletions
47
models/br_bd_diretorios_brasil/br_bd_diretorios_brasil__setor_censitario_2010.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{{ | ||
config( | ||
alias="setor_censitario_2010", | ||
schema="br_bd_diretorios_brasil", | ||
materialized="table", | ||
) | ||
}} | ||
|
||
with | ||
tb as ( | ||
select | ||
safe_cast(id_setor_censitario as string) id_setor_censitario, | ||
safe_cast(id_municipio as string) id_municipio, | ||
safe_cast(id_rm as string) id_regiao_metropolitana, | ||
safe_cast(id_distrito as string) id_distrito, | ||
safe_cast(id_subdistrito as string) id_subdistrito, | ||
safe_cast(nome_subdistrito as string) nome_subdistrito, | ||
safe_cast(id_bairro as string) id_bairro, | ||
safe_cast(nome_bairro as string) nome_bairro, | ||
safe_cast(sigla_uf as string) sigla_uf, | ||
safe_cast(situacao_setor as string) situacao_setor, | ||
safe_cast(tipo_setor as string) tipo_setor | ||
from `basedosdados-dev.br_bd_diretorios_brasil_staging.setor_censitario` as t | ||
) | ||
|
||
select | ||
a.id_setor_censitario, | ||
a.id_municipio, | ||
b.nome as nome_municipio, | ||
a.id_regiao_metropolitana, | ||
b.nome_regiao_metropolitana as nome_regiao_metropolitana, | ||
a.id_distrito, | ||
c.nome as nome_distrito, | ||
a.id_subdistrito, | ||
a.nome_subdistrito, | ||
a.id_bairro, | ||
a.nome_bairro, | ||
a.sigla_uf, | ||
a.situacao_setor, | ||
a.tipo_setor, | ||
from tb as a | ||
left join | ||
`basedosdados.br_bd_diretorios_brasil.municipio` as b | ||
on a.id_municipio = b.id_municipio | ||
left join | ||
`basedosdados.br_bd_diretorios_brasil.distrito` as c | ||
on a.id_distrito = c.id_distrito |
61 changes: 61 additions & 0 deletions
61
models/br_bd_diretorios_brasil/br_bd_diretorios_brasil__setor_censitario_2022.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{{ | ||
config( | ||
alias="setor_censitario_2022", | ||
schema="br_bd_diretorios_brasil", | ||
materialized="table", | ||
) | ||
}} | ||
|
||
with | ||
tb as ( | ||
select | ||
safe_cast(cd_setor as string) as id_setor_censitario, | ||
safe_cast(cd_regiao as string) as id_regiao, | ||
safe_cast(nm_regiao as string) as nome_regiao, | ||
safe_cast(cd_uf as string) as id_uf, | ||
safe_cast(cd_mun as string) as id_municipio, | ||
safe_cast(cd_dist as string) as id_distrito, | ||
safe_cast(cd_subdist as string) as id_subdistrito, | ||
safe_cast(nm_subdist as string) as nome_subdistrito, | ||
safe_cast(cd_micro as string) as id_microrregiao, | ||
safe_cast(cd_meso as string) as id_mesorregiao, | ||
safe_cast(cd_rgi as string) as id_regiao_imediata, | ||
safe_cast(cd_rgint as string) as id_regiao_intermediaria, | ||
safe_cast(cd_concurb as string) as id_concentracao_urbana, | ||
safe_cast(nm_concurb as string) as nome_concentracao_urbana, | ||
safe_cast(area_km2 as float64) as area_km2, | ||
from | ||
`basedosdados-dev.br_ibge_censo_2022_staging.domicilio_morador_setor_censitario` | ||
) | ||
|
||
select | ||
id_setor_censitario, | ||
id_regiao, | ||
a.nome_regiao, | ||
a.id_uf, | ||
b.nome as nome_uf, | ||
a.id_municipio, | ||
c.nome as nome_municipio, | ||
a.id_distrito, | ||
d.nome as nome_distrito, | ||
id_subdistrito, | ||
nome_subdistrito, | ||
a.id_microrregiao, | ||
c.nome_microrregiao, | ||
a.id_mesorregiao, | ||
c.nome_mesorregiao, | ||
a.id_regiao_imediata, | ||
c.nome_regiao_imediata, | ||
a.id_regiao_intermediaria, | ||
c.nome_regiao_intermediaria, | ||
a.id_concentracao_urbana, | ||
a.nome_concentracao_urbana, | ||
a.area_km2, | ||
from tb as a | ||
left join `basedosdados.br_bd_diretorios_brasil.uf` as b on a.id_uf = b.id_uf | ||
left join | ||
`basedosdados.br_bd_diretorios_brasil.municipio` as c | ||
on a.id_municipio = c.id_municipio | ||
left join | ||
`basedosdados.br_bd_diretorios_brasil.distrito` as d | ||
on a.id_distrito = d.id_distrito |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
models/br_inep_saeb/br_inep_saeb__brasil_taxa_alfabetizacao.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{{ | ||
config( | ||
alias="brasil_taxa_alfabetizacao", | ||
schema="br_inep_saeb", | ||
materialized="table", | ||
) | ||
}} | ||
select | ||
safe_cast(ano as int64) ano, | ||
safe_cast(rede as string) rede, | ||
safe_cast(localizacao as string) localizacao, | ||
safe_cast(area as string) area, | ||
safe_cast(taxa_alfabetizacao as float64) taxa_alfabetizacao, | ||
from `basedosdados-dev.br_inep_saeb_staging.brasil_taxa_alfabetizacao` as t |
Oops, something went wrong.