-
Notifications
You must be signed in to change notification settings - Fork 4
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 br-camara-dados
- Loading branch information
Showing
29 changed files
with
52,759 additions
and
2,971 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 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 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
21 changes: 21 additions & 0 deletions
21
models/br_cgu_dados_abertos/br_cgu_dados_abertos__conjunto.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,21 @@ | ||
{{ config(alias="conjunto", schema="br_cgu_dados_abertos") }} | ||
-- | ||
select | ||
safe_cast(nullif(id, "") as string) id, | ||
safe_cast(nullif(titulo, "") as string) nome, | ||
safe_cast(nullif(nome, "") as string) nome_tokenizado, | ||
safe_cast(nullif(descricao, "") as string) descricao, | ||
safe_cast(nullif(mantenedor, "") as string) mantenedor, | ||
safe_cast(nullif(email_mantenedor, "") as string) email_mantenedor, | ||
safe_cast( | ||
nullif(id_organizacao_responsavel, "") as string | ||
) id_organizacao_responsavel, | ||
safe_cast(nullif(organizacao_responsavel, "") as string) organizacao_responsavel, | ||
extract(date from safe.parse_datetime('%d/%m/%Y %T', data_criacao)) data_criacao, | ||
extract( | ||
date from safe.parse_datetime('%d/%m/%Y %T', data_atualizacao) | ||
) data_atualizacao, | ||
safe_cast(quantidade_reusos as int64) quantidade_reusos, | ||
safe_cast(quantidade_recursos as int64) quantidade_recursos, | ||
safe_cast(quantidade_downloads as int64) quantidade_downloads, | ||
from `basedosdados-staging.br_cgu_dados_abertos_staging.conjunto` as c |
25 changes: 25 additions & 0 deletions
25
models/br_cgu_dados_abertos/br_cgu_dados_abertos__organizacao.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,25 @@ | ||
{{ config(alias="organizacao", schema="br_cgu_dados_abertos") }} | ||
-- | ||
select | ||
safe_cast(nullif(o.id, "") as string) id, | ||
safe_cast(nullif(o.titulo, "") as string) nome, | ||
safe_cast(nullif(o.nome, "") as string) nome_tokenizado, | ||
safe_cast(nullif(o.descricao, "") as string) descricao, | ||
case | ||
when o.organizationesfera = "1" | ||
then "Federal" | ||
when o.organizationesfera = "2" | ||
then "Estadual/Distrital" | ||
when o.organizationesfera = "3" | ||
then "Municipal" | ||
else null | ||
end tipo_esfera_administrativa, | ||
safe_cast(nullif(o.organizationuf, "") as string) sigla_uf, | ||
safe_cast(m.id_municipio as string) id_municipio, | ||
safe_cast(o.qtdseguidores as int64) quantidade_seguidores, | ||
safe_cast(o.qtdconjuntodedados as int64) quantidade_conjuntos | ||
from `basedosdados-staging.br_cgu_dados_abertos_staging.organizacao` as o | ||
left join | ||
`basedosdados.br_bd_diretorios_brasil.municipio` as m | ||
on o.organizationuf = m.sigla_uf | ||
and o.organizationmunicipio = m.nome |
Oops, something went wrong.