-
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.
- Loading branch information
Showing
22 changed files
with
590 additions
and
107 deletions.
There are no files selected for viewing
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
42 changes: 42 additions & 0 deletions
42
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,42 @@ | ||
{{ | ||
config( | ||
schema='br_tse_eleicoes', | ||
alias = 'detalhes_votacao_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(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_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 |
43 changes: 43 additions & 0 deletions
43
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,43 @@ | ||
{{ | ||
config( | ||
schema='br_tse_eleicoes', | ||
alias = 'detalhes_votacao_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(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_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 |
43 changes: 43 additions & 0 deletions
43
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,43 @@ | ||
{{ | ||
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,56 @@ | ||
{{ | ||
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 | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
60 changes: 60 additions & 0 deletions
60
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,60 @@ | ||
{{ | ||
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(quantidade_eleitores AS INT64) quantidade_eleitores, | ||
SAFE_CAST(quantidade_eleitores_eleicao AS INT64) quantidade_eleitores_eleicao, | ||
FROM basedosdados-staging.br_tse_eleicoes_staging.perfil_eleitorado_local_votacao AS t | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
49 changes: 49 additions & 0 deletions
49
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,49 @@ | ||
{{ | ||
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 | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Oops, something went wrong.