Skip to content

Commit

Permalink
Atualiazar bens_candidato e candidatos
Browse files Browse the repository at this point in the history
  • Loading branch information
Winzen committed Aug 16, 2024
1 parent 8c63d0c commit 2f75fc2
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
4 changes: 2 additions & 2 deletions models/br_tse_eleicoes/br_tse_eleicoes__bens_candidato.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
partition_by={
"field": "ano",
"data_type": "int64",
"range": {"start": 2006, "end": 2022, "interval": 2},
"range": {"start": 2006, "end": 2024, "interval": 2},
},
)
}}
Expand All @@ -16,7 +16,7 @@ select
safe_cast(sigla_uf as string) sigla_uf,
safe_cast(id_eleicao as string) id_eleicao,
safe_cast(tipo_eleicao as string) tipo_eleicao,
safe_cast(data_eleicao as string) data_eleicao,
safe_cast(data_eleicao as date) data_eleicao,
safe_cast(sequencial_candidato as string) sequencial_candidato,
safe_cast(id_candidato_bd as string) id_candidato_bd,
safe_cast(id_tipo_item as string) id_tipo_item,
Expand Down
4 changes: 2 additions & 2 deletions models/br_tse_eleicoes/br_tse_eleicoes__candidatos.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
partition_by={
"field": "ano",
"data_type": "int64",
"range": {"start": 1994, "end": 2022, "interval": 2},
"range": {"start": 1994, "end": 2024, "interval": 2},
},
)
}}
Expand All @@ -15,7 +15,7 @@ select
safe_cast(ano as int64) ano,
safe_cast(id_eleicao as string) id_eleicao,
safe_cast(tipo_eleicao as string) tipo_eleicao,
safe_cast(data_eleicao as string) data_eleicao,
safe_cast(data_eleicao as date) data_eleicao,
safe_cast(sigla_uf as string) sigla_uf,
safe_cast(id_municipio as string) id_municipio,
safe_cast(id_municipio_tse as string) id_municipio_tse,
Expand Down
29 changes: 26 additions & 3 deletions models/br_tse_eleicoes/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ models:
description: Declaração de bens de candidatos em eleições brasileiras.
tests:
- not_null_proportion_multiple_columns:
at_least: 0.95
at_least: 0.55
columns:
- name: ano
description: Ano
Expand All @@ -15,6 +15,10 @@ models:
field: ano.ano
- name: data_eleicao
description: Data da eleição
tests:
- relationships:
to: ref('br_bd_diretorios_data_tempo__data')
field: data.data
- name: descricao_item
description: Descrição do item
- name: id_candidato_bd
Expand All @@ -40,6 +44,8 @@ models:
- name: br_tse_eleicoes__candidatos
description: Dados de candidatos em eleições brasileiras.
tests:
- not_null_proportion_multiple_columns:
at_least: 0.05
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- ano
Expand All @@ -63,12 +69,28 @@ models:
description: CPF
- name: data_eleicao
description: Data da eleição
tests:
- relationships:
to: ref('br_bd_diretorios_data_tempo__data')
field: data.data
- name: data_nascimento
description: Data de nascimento
tests:
- relationships:
- custom_relationships:
to: ref('br_bd_diretorios_data_tempo__data')
field: data.data
ignore_values:
- '9564-06-17'
- '5195-06-20'
- '9555-01-15'
- '6196-10-02'
- '7194-10-30'
- '5454-10-09'
- '6197-10-02'
- '9158-09-24'
- '7197-04-17'
- '9161-11-09'
- '7953-09-05'
- name: email
description: Email
- name: estado_civil
Expand All @@ -90,9 +112,10 @@ models:
- name: id_municipio_tse
description: ID Município - TSE
tests:
- relationships:
- custom_relationships:
to: ref('br_bd_diretorios_brasil__municipio')
field: id_municipio_tse
ignore_values: ['73709']
- name: instrucao
description: Instrução
- name: municipio_nascimento
Expand Down

0 comments on commit 2f75fc2

Please sign in to comment.