Skip to content

Commit

Permalink
Merge pull request #566 from basedosdados/add-test-in-diretorios
Browse files Browse the repository at this point in the history
[tests] br_bd_diretorios
  • Loading branch information
tricktx authored Jul 7, 2024
2 parents 67ed262 + 7741845 commit 42951f2
Show file tree
Hide file tree
Showing 22 changed files with 631 additions and 739 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{
config(
alias="area_conhecimento",
schema="br_bd_diretorios_brasil",
materialized="table",
)
}}

select distinct
safe_cast(especialidade as string) especialidade,
safe_cast(descricao_especialidade as string) descricao_especialidade,
safe_cast(subarea as string) subarea,
safe_cast(descricao_subarea as string) descricao_subarea,
safe_cast(area as string) area,
safe_cast(descricao_area as string) descricao_area,
safe_cast(grande_area as string) grande_area,
safe_cast(descricao_grande_area as string) descricao_grande_area
from `basedosdados-dev.br_bd_diretorios_brasil_staging.area_conhecimento` as t
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@
)
}}

select safe_cast(cbo_1994 as string) cbo_1994, safe_cast(descricao as string) descricao
select
safe_cast(cbo_1994 as string) as cbo_1994,
safe_cast(descricao as string) as descricao
from `basedosdados-dev.br_bd_diretorios_brasil_staging.cbo_1994` as t
11 changes: 11 additions & 0 deletions models/br_bd_diretorios_brasil/br_bd_diretorios_brasil__cid_9.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{
config(
alias="cid_9",
schema="br_bd_diretorios_brasil",
materialized="table",
)
}}

select
safe_cast(categoria as string) categoria, safe_cast(descricao as string) descricao
from `basedosdados-dev.br_bd_diretorios_brasil_staging.cid_9` as t
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{
config(
alias="curso_superior",
schema="br_bd_diretorios_brasil",
materialized="table",
)
}}

select
safe_cast(id_curso as string) id_curso,
safe_cast(nome_curso as string) nome_curso,
safe_cast(id_area as string) id_area,
safe_cast(nome_area as string) nome_area,
safe_cast(grau_academico as string) grau_academico
from `basedosdados-dev.br_bd_diretorios_brasil_staging.curso_superior` as t
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{
config(
alias="distrito_1991",
schema="br_bd_diretorios_brasil",
materialized="table",
)
}}

select
safe_cast(ano as int64) ano,
safe_cast(id_distrito as string) id_distrito,
safe_cast(nome as string) nome,
safe_cast(id_municipio as string) id_municipio,
safe_cast(sigla_uf as string) sigla_uf
from `basedosdados-dev.br_bd_diretorios_brasil_staging.distrito`
where ano = '1991'
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{
config(
alias="distrito_2000",
schema="br_bd_diretorios_brasil",
materialized="table",
)
}}

select
safe_cast(ano as int64) ano,
safe_cast(id_distrito as string) id_distrito,
safe_cast(nome as string) nome,
safe_cast(id_municipio as string) id_municipio,
safe_cast(sigla_uf as string) sigla_uf
from `basedosdados-dev.br_bd_diretorios_brasil_staging.distrito`
where ano = '2000'
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{
config(
alias="distrito_2010",
schema="br_bd_diretorios_brasil",
materialized="table",
)
}}

select
safe_cast(ano as int64) ano,
safe_cast(id_distrito as string) id_distrito,
safe_cast(nome as string) nome,
safe_cast(id_municipio as string) id_municipio,
safe_cast(sigla_uf as string) sigla_uf
from `basedosdados-dev.br_bd_diretorios_brasil_staging.distrito`
where ano = '2010'
29 changes: 29 additions & 0 deletions models/br_bd_diretorios_brasil/br_bd_diretorios_brasil__escola.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{{
config(
alias="escola",
schema="br_bd_diretorios_brasil",
materialized="table",
)
}}

select
safe_cast(id_escola as string) id_escola,
safe_cast(nome as string) nome,
safe_cast(id_municipio as string) id_municipio,
safe_cast(sigla_uf as string) sigla_uf,
safe_cast(restricao_atendimento as string) restricao_atendimento,
safe_cast(localizacao as string) localizacao,
safe_cast(localidade_diferenciada as string) localidade_diferenciada,
safe_cast(categoria_administrativa as string) categoria_administrativa,
safe_cast(endereco as string) endereco,
safe_cast(telefone as string) telefone,
safe_cast(dependencia_administrativa as string) dependencia_administrativa,
safe_cast(categoria_privada as string) categoria_privada,
safe_cast(conveniada_poder_publico as string) conveniada_poder_publico,
safe_cast(regulacao_conselho_educacao as string) regulacao_conselho_educacao,
safe_cast(porte as string) porte,
safe_cast(etapas_modalidades_oferecidas as string) etapas_modalidades_oferecidas,
safe_cast(outras_ofertas_educacionais as string) outras_ofertas_educacionais,
safe_cast(latitude as string) latitude,
safe_cast(longitude as string) longitude
from `basedosdados-dev.br_bd_diretorios_brasil_staging.escola` as t
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{
config(
alias="etnia_indigena",
schema="br_bd_diretorios_brasil",
materialized="table",
)
}}

select
safe_cast(id_etnia_indigena as string) id_etnia_indigena,
safe_cast(nome as string) nome
from `basedosdados-dev.br_bd_diretorios_brasil_staging.etnia_indigena` as t
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{
config(
alias="instituicao_ensino_superior",
schema="br_bd_diretorios_brasil",
materialized="table",
)
}}

select
safe_cast(id_ies as string) id_ies,
safe_cast(nome as string) nome,
safe_cast(tipo_instituicao as string) tipo_instituicao,
safe_cast(rede as string) rede,
safe_cast(situacao_funcionamento as string) situacao_funcionamento,
safe_cast(id_municipio as string) id_municipio,
safe_cast(sigla_uf as string) sigla_uf
from `basedosdados-dev.br_bd_diretorios_brasil_staging.instituicao_ensino_superior` as t
13 changes: 13 additions & 0 deletions models/br_bd_diretorios_brasil/br_bd_diretorios_brasil__pais.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{
config(
schema="br_bd_diretorios_brasil",
alias="pais",
materialized="table",
)
}}

select
safe_cast(id_pais as string) id_pais,
safe_cast(nome as string) nome,
safe_cast(nacionalidade as string) nacionalidade
from `basedosdados-dev.br_bd_diretorios_brasil_staging.pais` as t
10 changes: 10 additions & 0 deletions models/br_bd_diretorios_brasil/br_bd_diretorios_brasil__regiao.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{
config(
alias="regiao",
schema="br_bd_diretorios_brasil",
materialized="table",
)
}}

select safe_cast(sigla as string) sigla, safe_cast(nome as string) nome
from `basedosdados-dev.br_bd_diretorios_brasil_staging.regiao` as t
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{
config(
alias="setor_censitario",
schema="br_bd_diretorios_brasil",
materialized="table",
)
}}

select
safe_cast(ano as int64) ano,
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_rm,
safe_cast(nome_rm as string) nome_rm,
safe_cast(id_distrito as string) id_distrito,
safe_cast(nome_distrito as string) nome_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
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{
config(
alias="subatividade_ibge",
schema="br_bd_diretorios_brasil",
materialized="table",
)
}}

select
safe_cast(id_subatividade as string) id_subatividade,
safe_cast(descricao as string) descricao
from `basedosdados-dev.br_bd_diretorios_brasil_staging.subatividade_ibge` as t
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ select
safe_cast(sigla as string) sigla,
safe_cast(nome as string) nome,
safe_cast(regiao as string) regiao
from `basedosdados-staging.br_bd_diretorios_brasil_staging.uf` as t
from `basedosdados-dev.br_bd_diretorios_brasil_staging.uf` as t
Loading

0 comments on commit 42951f2

Please sign in to comment.