Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dados]Atualizar br_tse_eleicoes resultados_secao #626

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading