-
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.
- Loading branch information
Showing
30 changed files
with
750 additions
and
300 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
10 changes: 5 additions & 5 deletions
10
models/br_camara_dados_abertos/br_camara_dados_abertos__deputado_ocupacao.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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
{{ config(alias="deputado_ocupacao", schema="br_camara_dados_abertos") }} | ||
select | ||
safe_cast(ano_inicio as int64) ano_inicio, | ||
safe_cast(ano_fim as int64) ano_fim, | ||
safe_cast(id_deputado as string) id_deputado, | ||
safe_cast(sigla_uf as string) sigla_uf, | ||
select distinct | ||
safe_cast(id as string) id_deputado, | ||
safe_cast(anoinicio as int64) ano_inicio, | ||
safe_cast(anofim as int64) ano_fim, | ||
safe_cast(entidadeuf as string) sigla_uf, | ||
safe_cast(entidade as string) entidade, | ||
safe_cast(titulo as string) titulo, | ||
from `basedosdados-staging.br_camara_dados_abertos_staging.deputado_ocupacao` as t |
10 changes: 5 additions & 5 deletions
10
models/br_camara_dados_abertos/br_camara_dados_abertos__deputado_profissao.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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
{{ config(alias="deputado_profissao", schema="br_camara_dados_abertos") }} | ||
select | ||
safe_cast(id_deputado as int64) id_deputado, | ||
select distinct | ||
safe_cast(id as string) id_deputado, | ||
safe_cast( | ||
split(format_timestamp('%Y-%m-%dT%H:%M:%E*S', timestamp(data)), 'T')[ | ||
split(format_timestamp('%Y-%m-%dT%H:%M:%E*S', timestamp(datahora)), 'T')[ | ||
offset(0) | ||
] as date | ||
) data, | ||
safe_cast( | ||
split(format_timestamp('%Y-%m-%dT%H:%M:%E*S', timestamp(data)), 'T')[ | ||
split(format_timestamp('%Y-%m-%dT%H:%M:%E*S', timestamp(datahora)), 'T')[ | ||
offset(1) | ||
] as time | ||
) horario, | ||
safe_cast(id_profissao as string) id_profissao, | ||
safe_cast(codtipoprofissao as string) id_profissao, | ||
safe_cast(titulo as string) titulo, | ||
from `basedosdados-staging.br_camara_dados_abertos_staging.deputado_profissao` as t |
3 changes: 1 addition & 2 deletions
3
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
3 changes: 1 addition & 2 deletions
3
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 |
---|---|---|
@@ -1,7 +1,6 @@ | ||
# register flow | ||
{{ 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, | ||
safe_cast(siglaorgao as string) sigla_orgao | ||
from `basedosdados-staging.br_camara_dados_abertos_staging.evento_orgao` as t |
1 change: 0 additions & 1 deletion
1
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
1 change: 0 additions & 1 deletion
1
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
3 changes: 1 addition & 2 deletions
3
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
5 changes: 2 additions & 3 deletions
5
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
1 change: 0 additions & 1 deletion
1
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
2 changes: 1 addition & 1 deletion
2
models/br_camara_dados_abertos/br_camara_dados_abertos__legislatura.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
2 changes: 1 addition & 1 deletion
2
models/br_camara_dados_abertos/br_camara_dados_abertos__legislatura_mesa.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
21 changes: 21 additions & 0 deletions
21
models/br_camara_dados_abertos/br_camara_dados_abertos__licitacao.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="licitacao", schema="br_camara_dados_abertos") }} | ||
select | ||
safe_cast(ano as int64) ano_licitacao, | ||
safe_cast(idlicitacao as string) id_licitacao, | ||
safe_cast(anoprocesso as int64) ano_processo, | ||
safe_cast(numprocesso as string) id_processo, | ||
safe_cast(objeto as string) objeto, | ||
safe_cast(modalidade as string) modalidade, | ||
safe_cast(tipo as string) tipo, | ||
safe_cast(situacao as string) situacao, | ||
safe_cast(dataabertura as date) data_abertura, | ||
safe_cast(datapublicacao as date) data_publicacao, | ||
safe_cast(dataautorizacao as date) data_autorizacao, | ||
safe_cast(numitens as int64) quantidade_item, | ||
safe_cast(numunidades as int64) quantidade_unidade, | ||
safe_cast(numpropostas as int64) quantidade_proposta, | ||
safe_cast(numcontratos as int64) quantidade_contrato, | ||
safe_cast(vlrestimado as int64) valor_estimado, | ||
safe_cast(vlrcontratado as int64) valor_contratado, | ||
safe_cast(vlrpago as int64) valor_pago, | ||
from `basedosdados-staging.br_camara_dados_abertos_staging.licitacao` as t |
22 changes: 22 additions & 0 deletions
22
models/br_camara_dados_abertos/br_camara_dados_abertos__licitacao_contrato.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,22 @@ | ||
{{ config(alias="licitacao_contrato", schema="br_camara_dados_abertos") }} | ||
select distinct | ||
safe_cast(ano as int64) ano_licitacao, | ||
safe_cast(idlicitacao as string) id_licitacao, | ||
safe_cast(anocontrato as int64) ano_contrato, | ||
safe_cast(numcontrato as string) id_contrato, | ||
safe_cast(tipocontrato as string) tipo_contrato, | ||
safe_cast(situacaocontrato as string) situacao_contrato, | ||
safe_cast(objeto as string) descricao, | ||
safe_cast(dataassinatura as date) data_assinatura, | ||
safe_cast(datapublicacao as date) data_publicacao, | ||
safe_cast(datainiciovigenciaoriginal as date) data_inicio_contrato, | ||
safe_cast(datafimvigenciaoriginal as date) data_fim_contrato, | ||
safe_cast(datafimultimavigencia as date) data_fim_ultima_vigencia, | ||
safe_cast(fornecedornome as string) nome_fornecedor, | ||
safe_cast(fornecedorendereco as string) endereco_fornecedor, | ||
safe_cast(fornecedorcidade as string) cidade_fornecedor, | ||
safe_cast(fornecedorsiglauf as string) sigla_uf_fornecedor, | ||
safe_cast(fornecedorcpfcnpj as string) cpf_cnpj_fornecedor, | ||
safe_cast(vlroriginal as int64) valor_original, | ||
safe_cast(vlrtotal as int64) valor_total, | ||
from `basedosdados-staging.br_camara_dados_abertos_staging.licitacao_contrato` as t |
26 changes: 26 additions & 0 deletions
26
models/br_camara_dados_abertos/br_camara_dados_abertos__licitacao_item.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,26 @@ | ||
{{ config(alias="licitacao_item", schema="br_camara_dados_abertos") }} | ||
select | ||
safe_cast(ano as int64) ano_licitacao, | ||
safe_cast(idlicitacao as string) id_licitacao, | ||
safe_cast(numitem as string) id_item, | ||
safe_cast(replace(numsubitem, '.0', '') as string) id_sub_item, | ||
safe_cast(descricao as string) descricao, | ||
safe_cast(especificacao as string) especificacao, | ||
safe_cast(unidade as string) unidade, | ||
safe_cast(qtdlicitada as int64) quantidade_licitada, | ||
safe_cast(replace(vlrunitarioestimado, ".0", "") as int64) valor_unitario_estimado, | ||
safe_cast(replace(qtdcontratada, ".0", "") as int64) quantidade_contratada, | ||
safe_cast( | ||
replace(vlrunitariocontratado, ".0", "") as int64 | ||
) valor_unitario_contratado, | ||
safe_cast(replace(vlrtotalcontratado, ".0", "") as int64) valor_total_contratado, | ||
safe_cast(fornecedorcpfcnpj as string) cpf_cnpj_fornecedor, | ||
safe_cast(fornecedornome as string) nome_fornecedor, | ||
safe_cast(numcontrato as string) id_contrato, | ||
safe_cast(replace(anocontrato, ".0", "") as int64) ano_contrato, | ||
safe_cast(tipocontrato as string) tipo_contrato, | ||
safe_cast(situacaoitem as string) situacao_item, | ||
safe_cast(observacoes as string) observacao, | ||
safe_cast(naturezadespesa as string) natureza_despesa, | ||
safe_cast(programatrabalho as string) programa_trabalho, | ||
from `basedosdados-staging.br_camara_dados_abertos_staging.licitacao_item` as t |
22 changes: 22 additions & 0 deletions
22
models/br_camara_dados_abertos/br_camara_dados_abertos__licitacao_pedido.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,22 @@ | ||
{{ config(alias="licitacao_pedido", schema="br_camara_dados_abertos") }} | ||
select | ||
safe_cast(ano as int64) ano_licitacao, | ||
safe_cast(idlicitacao as string) id_licitacao, | ||
safe_cast(tiporegistro as string) tipo_registo, | ||
safe_cast(anopedido as int64) ano_pedido, | ||
safe_cast(numpedido as string) id_pedido, | ||
safe_cast( | ||
split(format_timestamp('%Y-%m-%d', timestamp(datahoracadastro)), ' ')[ | ||
safe_offset(0) | ||
] as date | ||
) data_cadastro, | ||
safe_cast( | ||
split( | ||
format_timestamp('%Y-%m-%d %H:%M:%E*S', timestamp(datahoracadastro)), ' ' | ||
)[safe_offset(1)] as time | ||
) horario_cadastro, | ||
safe_cast(idorgao as string) id_orgao, | ||
safe_cast(orgao as string) orgao, | ||
safe_cast(objeto as string) descricao, | ||
safe_cast(observacoes as string) observacao, | ||
from `basedosdados-staging.br_camara_dados_abertos_staging.licitacao_pedido` as t |
16 changes: 16 additions & 0 deletions
16
models/br_camara_dados_abertos/br_camara_dados_abertos__licitacao_proposta.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="licitacao_proposta", schema="br_camara_dados_abertos") }} | ||
select distinct | ||
safe_cast(ano as int64) ano, | ||
safe_cast(idlicitacao as string) id_licitacao, | ||
safe_cast(descricao as string) descricao, | ||
safe_cast(unidadeslicitadas as int64) quantidade_unidade_licitacao, | ||
safe_cast(vlrestimado as int64) valor_estimado, | ||
safe_cast(numproposta as string) id_proposta, | ||
safe_cast(replace(unidadesproposta, ".0", "") as int64) unidade_proposta, | ||
safe_cast(vlrproposta as int64) valor_proposta, | ||
safe_cast(marcaproposta as string) marca_proposta, | ||
safe_cast(fornecedorcpfcnpj as string) cpf_cnpj_fornecedor, | ||
safe_cast(fornecedorsituacao as string) fornecedor_situacao, | ||
safe_cast(dataproposta as date) data_proposta, | ||
safe_cast(diasvalidadeproposta as int64) validade_proposta, | ||
from `basedosdados-staging.br_camara_dados_abertos_staging.licitacao_proposta` as t |
1 change: 1 addition & 0 deletions
1
models/br_camara_dados_abertos/br_camara_dados_abertos__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
2 changes: 1 addition & 1 deletion
2
models/br_camara_dados_abertos/br_camara_dados_abertos__orgao_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
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
Oops, something went wrong.