-
Notifications
You must be signed in to change notification settings - Fork 1
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
8 changed files
with
1,652 additions
and
1,685 deletions.
There are no files selected for viewing
60 changes: 30 additions & 30 deletions
60
models/br_tse_eleicoes/br_tse_eleicoes__resultados_candidato.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,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 |
12 changes: 4 additions & 8 deletions
12
models/br_tse_eleicoes/br_tse_eleicoes__resultados_candidato_municipio.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
12 changes: 4 additions & 8 deletions
12
models/br_tse_eleicoes/br_tse_eleicoes__resultados_candidato_municipio_zona.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
68 changes: 33 additions & 35 deletions
68
models/br_tse_eleicoes/br_tse_eleicoes__resultados_candidato_secao.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,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 |
12 changes: 4 additions & 8 deletions
12
models/br_tse_eleicoes/br_tse_eleicoes__resultados_partido_municipio.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
12 changes: 4 additions & 8 deletions
12
models/br_tse_eleicoes/br_tse_eleicoes__resultados_partido_municipio_zona.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
Oops, something went wrong.