-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #534 from basedosdados/br_tse_eleicoes
`br_tse_eleicoes`
- Loading branch information
Showing
22 changed files
with
4,007 additions
and
441 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
39 changes: 39 additions & 0 deletions
39
models/br_tse_eleicoes/br_tse_eleicoes__detalhes_votacao_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{{ | ||
config( | ||
schema="br_tse_eleicoes", | ||
alias="detalhes_votacao_municipio", | ||
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(cargo as string) cargo, | ||
safe_cast(aptos as int64) aptos, | ||
safe_cast(secoes as int64) secoes, | ||
safe_cast(secoes_agregadas as int64) secoes_agregadas, | ||
safe_cast(aptos_totalizadas as int64) aptos_totalizadas, | ||
safe_cast(secoes_totalizadas as int64) secoes_totalizadas, | ||
safe_cast(comparecimento as int64) comparecimento, | ||
safe_cast(abstencoes as int64) abstencoes, | ||
safe_cast(votos_validos as int64) votos_validos, | ||
safe_cast(votos_brancos as int64) votos_brancos, | ||
safe_cast(votos_nulos as int64) votos_nulos, | ||
safe_cast(votos_nominais as int64) votos_nominais, | ||
safe_cast(votos_legenda as int64) votos_legenda, | ||
safe_cast(proporcao_comparecimento as float64) proporcao_comparecimento, | ||
safe_cast(proporcao_votos_validos as float64) proporcao_votos_validos, | ||
safe_cast(proporcao_votos_brancos as float64) proporcao_votos_brancos, | ||
safe_cast(proporcao_votos_nulos as float64) proporcao_votos_nulos | ||
from `basedosdados-staging.br_tse_eleicoes_staging.detalhes_votacao_municipio` as t |
40 changes: 40 additions & 0 deletions
40
models/br_tse_eleicoes/br_tse_eleicoes__detalhes_votacao_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{{ | ||
config( | ||
schema="br_tse_eleicoes", | ||
alias="detalhes_votacao_municipio_zona", | ||
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(cargo as string) cargo, | ||
safe_cast(aptos as int64) aptos, | ||
safe_cast(secoes as int64) secoes, | ||
safe_cast(secoes_agregadas as int64) secoes_agregadas, | ||
safe_cast(aptos_totalizadas as int64) aptos_totalizadas, | ||
safe_cast(secoes_totalizadas as int64) secoes_totalizadas, | ||
safe_cast(comparecimento as int64) comparecimento, | ||
safe_cast(abstencoes as int64) abstencoes, | ||
safe_cast(votos_validos as int64) votos_validos, | ||
safe_cast(votos_brancos as int64) votos_brancos, | ||
safe_cast(votos_nulos as int64) votos_nulos, | ||
safe_cast(votos_nominais as int64) votos_nominais, | ||
safe_cast(votos_legenda as int64) votos_legenda, | ||
safe_cast(proporcao_comparecimento as float64) proporcao_comparecimento, | ||
safe_cast(proporcao_votos_validos as float64) proporcao_votos_validos, | ||
safe_cast(proporcao_votos_brancos as float64) proporcao_votos_brancos, | ||
safe_cast(proporcao_votos_nulos as float64) proporcao_votos_nulos | ||
from `basedosdados-staging.br_tse_eleicoes_staging.detalhes_votacao_municipio_zona` as t |
39 changes: 39 additions & 0 deletions
39
models/br_tse_eleicoes/br_tse_eleicoes__detalhes_votacao_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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{{ | ||
config( | ||
schema="br_tse_eleicoes", | ||
alias="detalhes_votacao_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(aptos as int64) aptos, | ||
safe_cast(comparecimento as int64) comparecimento, | ||
safe_cast(abstencoes as int64) abstencoes, | ||
safe_cast(votos_nominais as int64) votos_nominais, | ||
safe_cast(votos_brancos as int64) votos_brancos, | ||
safe_cast(votos_nulos as int64) votos_nulos, | ||
safe_cast(votos_coligacao as int64) votos_coligacao, | ||
safe_cast(votos_nulos_apu_sep as int64) votos_nulos_apu_sep, | ||
safe_cast(votos_pendentes as int64) votos_pendentes, | ||
safe_cast(proporcao_comparecimento as float64) proporcao_comparecimento, | ||
safe_cast(proporcao_votos_nominais as float64) proporcao_votos_nominais, | ||
safe_cast(proporcao_votos_coligacao as float64) proporcao_votos_coligacao, | ||
safe_cast(proporcao_votos_brancos as float64) proporcao_votos_brancos, | ||
safe_cast(proporcao_votos_nulos as float64) proporcao_votos_nulos | ||
from `basedosdados-staging.br_tse_eleicoes_staging.detalhes_votacao_secao` as t |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{{ | ||
config( | ||
schema="br_tse_eleicoes", | ||
alias="dicionario", | ||
materialized="table", | ||
) | ||
}} | ||
|
||
select | ||
safe_cast(id_tabela as string) id_tabela, | ||
safe_cast(nome_coluna as string) nome_coluna, | ||
safe_cast(chave as string) chave, | ||
safe_cast(cobertura_temporal as string) cobertura_temporal, | ||
safe_cast(valor as string) valor, | ||
from `basedosdados-staging.br_tse_eleicoes_staging.dicionario` as t |
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{{ | ||
config( | ||
schema="br_tse_eleicoes", | ||
alias="partidos", | ||
materialized="table", | ||
partition_by={ | ||
"field": "ano", | ||
"data_type": "int64", | ||
"range": {"start": 1990, "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(cargo as string) cargo, | ||
safe_cast(numero as string) numero, | ||
safe_cast(sigla as string) sigla, | ||
safe_cast(nome as string) nome, | ||
safe_cast(tipo_agremiacao as string) tipo_agremiacao, | ||
safe_cast(sequencial_coligacao as string) sequencial_coligacao, | ||
safe_cast(nome_coligacao as string) nome_coligacao, | ||
safe_cast(composicao_coligacao as string) composicao_coligacao, | ||
safe_cast(numero_federacao as string) numero_federacao, | ||
safe_cast(nome_federacacao as string) nome_federacacao, | ||
safe_cast(sigla_federacao as string) sigla_federacao, | ||
safe_cast(composicao_federacao as string) composicao_federacao, | ||
safe_cast(situacao_legenda as string) situacao_legenda | ||
from `basedosdados-staging.br_tse_eleicoes_staging.partidos` as t |
39 changes: 39 additions & 0 deletions
39
models/br_tse_eleicoes/br_tse_eleicoes__perfil_eleitorado_local_votacao.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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{{ | ||
config( | ||
schema="br_tse_eleicoes", | ||
alias="perfil_eleitorado_local_votacao", | ||
materialized="table", | ||
partition_by={ | ||
"field": "ano", | ||
"data_type": "int64", | ||
"range": {"start": 2016, "end": 2022, "interval": 2}, | ||
}, | ||
cluster_by=["sigla_uf"], | ||
) | ||
}} | ||
|
||
select | ||
safe_cast(ano as int64) ano, | ||
safe_cast(turno as int64) turno, | ||
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(tipo_secao_agregada as string) tipo_secao_agregada, | ||
safe_cast(numero as string) numero, | ||
safe_cast(nome as string) nome, | ||
safe_cast(tipo as string) tipo, | ||
safe_cast(endereco as string) endereco, | ||
safe_cast(bairro as string) bairro, | ||
safe_cast(cep as string) cep, | ||
safe_cast(telefone as string) telefone, | ||
safe_cast(latitude as float64) latitude, | ||
safe_cast(longitude as float64) longitude, | ||
safe_cast(situacao as string) situacao, | ||
safe_cast(situacao_zona as string) situacao_zona, | ||
safe_cast(situacao_secao as string) situacao_secao, | ||
safe_cast(situacao_localidade as string) situacao_localidade, | ||
safe_cast(situacao_secao_acessibilidade as string) situacao_secao_acessibilidade, | ||
safe_cast(eleitores_secao as int64) eleitores_secao, | ||
from `basedosdados-staging.br_tse_eleicoes_staging.perfil_eleitorado_local_votacao` as t |
30 changes: 30 additions & 0 deletions
30
models/br_tse_eleicoes/br_tse_eleicoes__perfil_eleitorado_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{{ | ||
config( | ||
schema="br_tse_eleicoes", | ||
alias="perfil_eleitorado_municipio_zona", | ||
materialized="table", | ||
partition_by={ | ||
"field": "ano", | ||
"data_type": "int64", | ||
"range": {"start": 1998, "end": 2022, "interval": 2}, | ||
}, | ||
cluster_by=["sigla_uf"], | ||
) | ||
}} | ||
|
||
select | ||
safe_cast(ano as int64) ano, | ||
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(situacao_biometria as string) situacao_biometria, | ||
safe_cast(zona as string) zona, | ||
safe_cast(genero as string) genero, | ||
safe_cast(estado_civil as string) estado_civil, | ||
safe_cast(grupo_idade as string) grupo_idade, | ||
safe_cast(instrucao as string) instrucao, | ||
safe_cast(eleitores as string) eleitores, | ||
safe_cast(eleitores_biometria as string) eleitores_biometria, | ||
safe_cast(eleitores_deficiencia as string) eleitores_deficiencia | ||
from | ||
`basedosdados-staging.br_tse_eleicoes_staging.perfil_eleitorado_municipio_zona` as t |
31 changes: 31 additions & 0 deletions
31
models/br_tse_eleicoes/br_tse_eleicoes__perfil_eleitorado_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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{{ | ||
config( | ||
schema="br_tse_eleicoes", | ||
alias="perfil_eleitorado_secao", | ||
materialized="table", | ||
partition_by={ | ||
"field": "ano", | ||
"data_type": "int64", | ||
"range": {"start": 2008, "end": 2022, "interval": 2}, | ||
}, | ||
cluster_by=["sigla_uf"], | ||
) | ||
}} | ||
|
||
select | ||
safe_cast(ano as int64) ano, | ||
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(situacao_biometria as string) situacao_biometria, | ||
safe_cast(zona as string) zona, | ||
safe_cast(secao as string) secao, | ||
safe_cast(genero as string) genero, | ||
safe_cast(estado_civil as string) estado_civil, | ||
safe_cast(grupo_idade as string) grupo_idade, | ||
safe_cast(instrucao as string) instrucao, | ||
safe_cast(eleitores as string) eleitores, | ||
safe_cast(eleitores_biometria as string) eleitores_biometria, | ||
safe_cast(eleitores_deficiencia as string) eleitores_deficiencia, | ||
safe_cast(eleitores_inclusao_nome_social as string) eleitores_inclusao_nome_social | ||
from `basedosdados-staging.br_tse_eleicoes_staging.perfil_eleitorado_secao` as t |
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
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
30 changes: 30 additions & 0 deletions
30
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{{ | ||
config( | ||
schema="br_tse_eleicoes", | ||
alias="resultados_candidato_municipio", | ||
materialized="table", | ||
partition_by={ | ||
"field": "ano", | ||
"data_type": "int64", | ||
"range": {"start": 1998, "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(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(resultado as string) resultado, | ||
safe_cast(votos as int64) votos | ||
from `basedosdados-staging.br_tse_eleicoes_staging.resultados_candidato_municipio` as t |
Oops, something went wrong.