Skip to content

Commit

Permalink
Atualizar segundo turno resultados_candidato_municipio_zona
Browse files Browse the repository at this point in the history
  • Loading branch information
Winzen committed Nov 12, 2024
1 parent 1b2efc0 commit 419f9e1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@
partition_by={
"field": "ano",
"data_type": "int64",
"range": {"start": 1998, "end": 2022, "interval": 2},
"range": {"start": 1994, "end": 2024, "interval": 2},
},
cluster_by=["sigla_uf"],
)
}}

select
safe_cast(ano as int64) ano,
safe_cast(turno as int64) turno,
safe_cast(id_eleicao as string) id_eleicao,
safe_cast(tipo_eleicao as string) tipo_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 All @@ -28,4 +29,6 @@ select
safe_cast(id_candidato_bd as string) id_candidato_bd,
safe_cast(resultado as string) resultado,
safe_cast(votos as int64) votos
from `basedosdados-dev.br_tse_eleicoes_staging.resultados_candidato_municipio_zona` as t
from
`basedosdados-staging.br_tse_eleicoes_staging.resultados_candidato_municipio_zona`
as t
22 changes: 21 additions & 1 deletion models/br_tse_eleicoes/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1309,12 +1309,14 @@ models:
- ano
- turno
- id_eleicao
- sigla_uf
- id_municipio_tse
- cargo
- zona
- sequencial_candidato
- numero_candidato
- not_null_proportion_multiple_columns:
at_least: 0.95
at_least: 0.80
columns:
- name: ano
description: Ano
Expand All @@ -1326,14 +1328,27 @@ models:
description: Cargo
- name: data_eleicao
description: Data da eleição
tests:
- relationships:
to: ref('br_bd_diretorios_data_tempo__data')
field: data.data
- name: id_candidato_bd
description: ID Candidato - Base dos Dados
- name: id_eleicao
description: ID Eleição
- name: id_municipio
description: ID Município - IBGE 7 Dígitos
tests:
- relationships:
to: ref('br_bd_diretorios_brasil__municipio')
field: id_municipio
- name: id_municipio_tse
description: ID Município - TSE
tests:
- custom_relationships:
to: ref('br_bd_diretorios_brasil__municipio')
field: id_municipio_tse
ignore_values: ['73709']
- name: numero_candidato
description: Número do candidato
- name: numero_partido
Expand All @@ -1346,6 +1361,11 @@ models:
description: Sigla do partido
- name: sigla_uf
description: Sigla da unidade da federação
tests:
- custom_relationships:
to: ref('br_bd_diretorios_brasil__uf')
field: sigla
ignore_values: [GB, GP, RB]
- name: tipo_eleicao
description: Tipo da eleição
- name: turno
Expand Down

0 comments on commit 419f9e1

Please sign in to comment.