-
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 #390 from basedosdados/update_br_tse_eleicoes
[dbt] `br_tse_eleicoes`
- Loading branch information
Showing
10 changed files
with
320 additions
and
14 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
18 changes: 18 additions & 0 deletions
18
...ls/br_tse_eleicoes/despesas_candidato.sql → ...s/br_tse_eleicoes__despesas_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
18 changes: 18 additions & 0 deletions
18
...ls/br_tse_eleicoes/receitas_candidato.sql → ...s/br_tse_eleicoes__receitas_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
18 changes: 18 additions & 0 deletions
18
models/br_tse_eleicoes/receitas_comite.sql → ...coes/br_tse_eleicoes__receitas_comite.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
18 changes: 18 additions & 0 deletions
18
...se_eleicoes/receitas_orgao_partidario.sql → ...e_eleicoes__receitas_orgao_partidario.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
35 changes: 35 additions & 0 deletions
35
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{{ | ||
config( | ||
schema='br_tse_eleicoes', | ||
alias = 'resultados_candidato', | ||
materialized='table', | ||
partition_by={ | ||
"field": "ano", | ||
"data_type": "int64", | ||
"range": { | ||
"start": 1945, | ||
"end": 2022, | ||
"interval": 1 | ||
} | ||
}, | ||
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(nome_candidato AS STRING) nome_candidato, | ||
SAFE_CAST(resultado AS STRING) resultado, | ||
SAFE_CAST(votos AS INT64) votos | ||
FROM basedosdados-staging.br_tse_eleicoes_staging.resultados_candidato AS t |
35 changes: 35 additions & 0 deletions
35
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{{ | ||
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-staging.br_tse_eleicoes_staging.resultados_candidato_secao AS t |
33 changes: 33 additions & 0 deletions
33
models/br_tse_eleicoes/br_tse_eleicoes__resultados_partido_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,33 @@ | ||
{{ | ||
config( | ||
schema='br_tse_eleicoes', | ||
alias = 'resultados_partido_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(votos_nominais AS INT64) votos_nominais, | ||
SAFE_CAST(votos_nao_nominais AS INT64) votos_nao_nominais | ||
FROM basedosdados-staging.br_tse_eleicoes_staging.resultados_partido_secao AS t |
Oops, something went wrong.