Skip to content

Commit

Permalink
Atualizar resultados_secao
Browse files Browse the repository at this point in the history
  • Loading branch information
Winzen committed Nov 12, 2024
1 parent cf821bc commit f9713cb
Show file tree
Hide file tree
Showing 8 changed files with 1,652 additions and 1,685 deletions.
60 changes: 30 additions & 30 deletions models/br_tse_eleicoes/br_tse_eleicoes__resultados_candidato.sql
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
{{
config(
schema="br_tse_eleicoes",
alias="resultados_candidato",
materialized="table",
partition_by={
"field": "ano",
"data_type": "int64",
"range": {"start": 1945, "end": 2022, "interval": 1},
},
)
}}

select
safe_cast(ano as int64) ano,
safe_cast(turno as int64) turno,
safe_cast(tipo_eleicao as string) tipo_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,
safe_cast(cargo as string) cargo,
safe_cast(numero_partido as string) numero_partido,
safe_cast(sigla_partido as string) sigla_partido,
safe_cast(numero_candidato as string) numero_candidato,
safe_cast(sequencial_candidato as string) sequencial_candidato,
safe_cast(id_candidato_bd as string) id_candidato_bd,
safe_cast(nome_candidato as string) nome_candidato,
safe_cast(resultado as string) resultado,
safe_cast(votos as int64) votos
from `basedosdados-dev.br_tse_eleicoes_staging.resultados_candidato` as t
{{
config(
schema="br_tse_eleicoes",
alias="resultados_candidato",
materialized="table",
partition_by={
"field": "ano",
"data_type": "int64",
"range": {"start": 1945, "end": 2022, "interval": 1},
},
)
}}

select
safe_cast(ano as int64) ano,
safe_cast(turno as int64) turno,
safe_cast(tipo_eleicao as string) tipo_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,
safe_cast(cargo as string) cargo,
safe_cast(numero_partido as string) numero_partido,
safe_cast(sigla_partido as string) sigla_partido,
safe_cast(numero_candidato as string) numero_candidato,
safe_cast(sequencial_candidato as string) sequencial_candidato,
safe_cast(id_candidato_bd as string) id_candidato_bd,
safe_cast(nome_candidato as string) nome_candidato,
safe_cast(resultado as string) resultado,
safe_cast(votos as int64) votos
from `basedosdados-dev.br_tse_eleicoes_staging.resultados_candidato` as t
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
{{
config(
schema='br_tse_eleicoes',
alias = 'resultados_candidato_municipio',
materialized='table',
schema="br_tse_eleicoes",
alias="resultados_candidato_municipio",
materialized="table",
partition_by={
"field": "ano",
"data_type": "int64",
"range": {
"start": 1998,
"end": 2022,
"interval": 2
}
"range": {"start": 1998, "end": 2022, "interval": 2},
},
cluster_by=["sigla_uf"],
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
{{
config(
schema='br_tse_eleicoes',
alias = 'resultados_candidato_municipio_zona',
materialized='table',
schema="br_tse_eleicoes",
alias="resultados_candidato_municipio_zona",
materialized="table",
partition_by={
"field": "ano",
"data_type": "int64",
"range": {
"start": 1998,
"end": 2022,
"interval": 2
}
"range": {"start": 1998, "end": 2022, "interval": 2},
},
cluster_by=["sigla_uf"],
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
{{
config(
schema='br_tse_eleicoes',
alias = 'resultados_candidato_secao',
materialized='table',
partition_by={
"field": "ano",
"data_type": "int64",
"range": {
"start": 1994,
"end": 2022,
"interval": 2
}
},
cluster_by=["sigla_uf"],
)
}}

select
safe_cast(ano as int64) ano,
safe_cast(turno as int64) turno,
safe_cast(tipo_eleicao as string) tipo_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,
safe_cast(zona as string) zona,
safe_cast(secao as string) secao,
safe_cast(cargo as string) cargo,
safe_cast(numero_partido as string) numero_partido,
safe_cast(sigla_partido as string) sigla_partido,
safe_cast(sequencial_candidato as string) sequencial_candidato,
safe_cast(numero_candidato as string) numero_candidato,
safe_cast(id_candidato_bd as string) id_candidato_bd,
safe_cast(votos as int64) votos
from `basedosdados-dev.br_tse_eleicoes_staging.resultados_candidato_secao` as t
{{
config(
schema="br_tse_eleicoes",
alias="resultados_candidato_secao",
materialized="table",
partition_by={
"field": "ano",
"data_type": "int64",
"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,
safe_cast(zona as string) zona,
safe_cast(secao as string) secao,
safe_cast(cargo as string) cargo,
safe_cast(numero_partido as string) numero_partido,
safe_cast(sigla_partido as string) sigla_partido,
safe_cast(sequencial_candidato as string) sequencial_candidato,
safe_cast(numero_candidato as string) numero_candidato,
safe_cast(id_candidato_bd as string) id_candidato_bd,
safe_cast(votos as int64) votos
from `basedosdados-dev.br_tse_eleicoes_staging.resultados_candidato_secao` as t
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
{{
config(
schema='br_tse_eleicoes',
alias = 'resultados_partido_municipio',
materialized='table',
schema="br_tse_eleicoes",
alias="resultados_partido_municipio",
materialized="table",
partition_by={
"field": "ano",
"data_type": "int64",
"range": {
"start": 1994,
"end": 2022,
"interval": 2
}
"range": {"start": 1994, "end": 2022, "interval": 2},
},
cluster_by=["sigla_uf"],
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
{{
config(
schema='br_tse_eleicoes',
alias = 'resultados_partido_municipio_zona',
materialized='table',
schema="br_tse_eleicoes",
alias="resultados_partido_municipio_zona",
materialized="table",
partition_by={
"field": "ano",
"data_type": "int64",
"range": {
"start": 1994,
"end": 2022,
"interval": 2
}
"range": {"start": 1994, "end": 2022, "interval": 2},
},
cluster_by=["sigla_uf"],
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
{{
config(
schema='br_tse_eleicoes',
alias = 'resultados_partido_secao',
materialized='table',
schema="br_tse_eleicoes",
alias="resultados_partido_secao",
materialized="table",
partition_by={
"field": "ano",
"data_type": "int64",
"range": {
"start": 1994,
"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 @@ -29,5 +26,5 @@ select
safe_cast(numero_partido as string) numero_partido,
safe_cast(sigla_partido as string) sigla_partido,
safe_cast(votos_nominais as int64) votos_nominais,
safe_cast(votos_nao_nominais as int64) votos_nao_nominais
safe_cast(votos_legenda as int64) votos_legenda
from `basedosdados-dev.br_tse_eleicoes_staging.resultados_partido_secao` as t
Loading

0 comments on commit f9713cb

Please sign in to comment.