-
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 pull request #439 from basedosdados/br-camara-dados
[dbt] br_camara_dados_abertos
- Loading branch information
Showing
8 changed files
with
418 additions
and
2 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
models/br_camara_dados_abertos/br_camara_dados_abertos__evento.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,30 @@ | ||
{{ config(alias="evento", schema="br_camara_dados_abertos") }} | ||
select | ||
safe_cast(id as string) id, | ||
safe_cast(urldocumentopauta as string) url_documento_pauta, | ||
safe_cast( | ||
split(format_timestamp('%Y-%m-%dT%H:%M:%E*S', timestamp(datahorainicio)), 'T')[ | ||
offset(0) | ||
] as date | ||
) data_inicio, | ||
safe_cast( | ||
split(format_timestamp('%Y-%m-%dT%H:%M:%E*S', timestamp(datahorainicio)), 'T')[ | ||
offset(1) | ||
] as time | ||
) horario_inicio, | ||
safe_cast( | ||
split(format_timestamp('%Y-%m-%dT%H:%M:%E*S', timestamp(datahorafim)), 'T')[ | ||
offset(0) | ||
] as date | ||
) data_final, | ||
safe_cast( | ||
split(format_timestamp('%Y-%m-%dT%H:%M:%E*S', timestamp(datahorafim)), 'T')[ | ||
offset(1) | ||
] as time | ||
) horario_final, | ||
safe_cast(situacao as string) situacao, | ||
safe_cast(descricao as string) descricao, | ||
safe_cast(descricaotipo as string) tipo, | ||
safe_cast(localexterno as string) local_externo, | ||
safe_cast(localcamara_nome as string) nome_local, | ||
from `basedosdados-staging.br_camara_dados_abertos_staging.evento` as t |
6 changes: 6 additions & 0 deletions
6
models/br_camara_dados_abertos/br_camara_dados_abertos__evento_orgao.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,6 @@ | ||
{{ config(alias="evento_orgao", schema="br_camara_dados_abertos") }} | ||
select | ||
safe_cast(idevento as string) id_evento, | ||
safe_cast(idorgao as string) id_orgao, | ||
safe_cast(siglaorgao as string) sigla_orgao, | ||
from `basedosdados-staging.br_camara_dados_abertos_staging.evento_orgao` as t |
16 changes: 16 additions & 0 deletions
16
models/br_camara_dados_abertos/br_camara_dados_abertos__evento_presenca_deputado.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,16 @@ | ||
{{ config(alias="evento_presenca_deputado", schema="br_camara_dados_abertos") }} | ||
select distinct | ||
safe_cast(idevento as string) id_evento, | ||
safe_cast( | ||
split(format_timestamp('%Y-%m-%dT%H:%M:%E*S', timestamp(datahorainicio)), 'T')[ | ||
offset(0) | ||
] as date | ||
) data_inicio, | ||
safe_cast( | ||
split(format_timestamp('%Y-%m-%dT%H:%M:%E*S', timestamp(datahorainicio)), 'T')[ | ||
offset(1) | ||
] as time | ||
) horario_inicio, | ||
safe_cast(iddeputado as string) id_deputado, | ||
from | ||
`basedosdados-staging.br_camara_dados_abertos_staging.evento_presenca_deputado` as t |
6 changes: 6 additions & 0 deletions
6
models/br_camara_dados_abertos/br_camara_dados_abertos__evento_requerimento.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,6 @@ | ||
{{ config(alias="evento_requerimento", schema="br_camara_dados_abertos") }} | ||
select | ||
safe_cast(idevento as string) id_evento, | ||
safe_cast(titulorequerimento as string) titulo_requerimento, | ||
regexp_extract(urirequerimento, r'/([^/]+)$') id_proposicao | ||
from `basedosdados-staging.br_camara_dados_abertos_staging.evento_requerimento` as t |
13 changes: 13 additions & 0 deletions
13
models/br_camara_dados_abertos/br_camara_dados_abertos__frente.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,13 @@ | ||
{{ config(alias="frente", schema="br_camara_dados_abertos") }} | ||
select | ||
safe_cast(id as string) id, | ||
safe_cast(titulo as string) titulo, | ||
safe_cast(datacriacao as date) data_criacao, | ||
safe_cast(idlegislatura as string) id_legislatura, | ||
safe_cast(telefone as string) telefone, | ||
safe_cast(situacao as string) situacao, | ||
safe_cast(urldocumento as string) url_documento, | ||
safe_cast(coordenador_id as string) id_coordenador, | ||
safe_cast(coordenador_nome as string) nome_coordenador, | ||
safe_cast(coordenador_urlfoto as string) url_foto_coordenador, | ||
from `basedosdados-staging.br_camara_dados_abertos_staging.frente` as t |
9 changes: 9 additions & 0 deletions
9
models/br_camara_dados_abertos/br_camara_dados_abertos__frente_deputado.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,9 @@ | ||
{{ config(alias="frente_deputado", schema="br_camara_dados_abertos") }} | ||
select | ||
safe_cast(id as string) id_frente, | ||
safe_cast(titulo as string) titulo, | ||
safe_cast(id_deputado as string) id_deputado, | ||
initcap(nome_deputado) nome_deputado, | ||
safe_cast(titulo_deputado as string) titulo_deputado, | ||
safe_cast(url_foto_deputado as string) url_foto_deputado, | ||
from `basedosdados-staging.br_camara_dados_abertos_staging.frente_deputado` as t |
13 changes: 13 additions & 0 deletions
13
models/br_camara_dados_abertos/br_camara_dados_abertos__funcionario.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,13 @@ | ||
{{ config(alias="funcionario", schema="br_camara_dados_abertos") }} | ||
select distinct | ||
safe_cast(nome as string) nome, | ||
safe_cast(cargo as string) cargo, | ||
safe_cast(funcao as string) funcao, | ||
safe_cast(datainiciohistorico as date) data_inicio_historico, | ||
safe_cast(datanomeacao as date) data_nomeacao, | ||
safe_cast(datapubnomeacao as date) data_publicacao_nomeacao, | ||
safe_cast(grupo as string) grupo, | ||
safe_cast(ponto as string) ponto, | ||
safe_cast(atonomeacao as string) ato_nomeacao, | ||
safe_cast(lotacao as string) lotacao, | ||
from `basedosdados-staging.br_camara_dados_abertos_staging.funcionario` as t |
Oops, something went wrong.