-
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 #133 from basedosdados/bdpro_mundo_transfermarkt_c…
…ompeticoes [bdpro] mundo_transfermarkt_competicoes
- Loading branch information
Showing
4 changed files
with
147 additions
and
15 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
54 changes: 54 additions & 0 deletions
54
models/mundo_transfermarkt_competicoes/brasileirao_serie_a_atualizado.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,54 @@ | ||
{{ | ||
config( | ||
schema='mundo_transfermarkt_competicoes', | ||
materialized='table', | ||
partition_by={ | ||
"field": "ano_campeonato", | ||
"data_type": "int64", | ||
"range": { | ||
"start": 2003, | ||
"end": 2023, | ||
"interval": 1} | ||
}, | ||
labels = {'tema': 'esporte'}, | ||
post_hook=['REVOKE `roles/bigquery.dataViewer` ON TABLE {{ this }} FROM "specialGroup:allUsers"', | ||
'GRANT `roles/bigquery.dataViewer` ON TABLE {{ this }} TO "group:bd-pro@basedosdados.org"']) | ||
}} | ||
SELECT | ||
SAFE_CAST(REPLACE (ano_campeonato,".0","") AS INT64) ano_campeonato, | ||
SAFE_CAST(data AS DATE) data, | ||
SAFE_CAST(horario AS STRING) horario, | ||
SAFE_CAST(REPLACE (rodada,".0","") AS INT64) rodada, | ||
SAFE_CAST(estadio AS STRING) estadio, | ||
SAFE_CAST(arbitro AS STRING) arbitro, | ||
SAFE_CAST(REPLACE (publico,".0","") AS INT64) publico, | ||
SAFE_CAST(REPLACE (publico_max,".0","") AS INT64) publico_max, | ||
SAFE_CAST(time_man AS STRING) time_man, | ||
SAFE_CAST(time_vis AS STRING) time_vis, | ||
SAFE_CAST(tecnico_man AS STRING) tecnico_man, | ||
SAFE_CAST(tecnico_vis AS STRING) tecnico_vis, | ||
SAFE_CAST(REPLACE (colocacao_man,".0","") AS INT64) colocacao_man, | ||
SAFE_CAST(REPLACE (colocacao_vis,".0","") AS INT64) colocacao_vis, | ||
SAFE_CAST(REPLACE (valor_equipe_titular_man,".0","") AS INT64) valor_equipe_titular_man, | ||
SAFE_CAST(REPLACE (valor_equipe_titular_vis,".0","") AS INT64) valor_equipe_titular_vis, | ||
SAFE_CAST(idade_media_titular_man AS FLOAT64) idade_media_titular_man, | ||
SAFE_CAST(idade_media_titular_vis AS FLOAT64) idade_media_titular_vis, | ||
SAFE_CAST(REPLACE (gols_man,".0","") AS INT64) gols_man, | ||
SAFE_CAST(REPLACE (gols_vis,".0","") AS INT64) gols_vis, | ||
SAFE_CAST(REPLACE (gols_1_tempo_man,".0","") AS INT64) gols_1_tempo_man, | ||
SAFE_CAST(REPLACE (gols_1_tempo_vis,".0","") AS INT64) gols_1_tempo_vis, | ||
SAFE_CAST(REPLACE (escanteios_man,".0","") AS INT64) escanteios_man, | ||
SAFE_CAST(REPLACE (escanteios_vis,".0","") AS INT64) escanteios_vis, | ||
SAFE_CAST(REPLACE (faltas_man,".0","") AS INT64) faltas_man, | ||
SAFE_CAST(REPLACE (faltas_vis,".0","") AS INT64) faltas_vis, | ||
SAFE_CAST(REPLACE (chutes_bola_parada_man,".0","") AS INT64) chutes_bola_parada_man, | ||
SAFE_CAST(REPLACE (chutes_bola_parada_vis,".0","") AS INT64) chutes_bola_parada_vis, | ||
SAFE_CAST(REPLACE (defesas_man,".0","") AS INT64) defesas_man, | ||
SAFE_CAST(REPLACE (defesas_vis,".0","") AS INT64) defesas_vis, | ||
SAFE_CAST(REPLACE (impedimentos_man,".0","") AS INT64) impedimentos_man, | ||
SAFE_CAST(REPLACE (impedimentos_vis,".0","") AS INT64) impedimentos_vis, | ||
SAFE_CAST(REPLACE (chutes_man,".0","") AS INT64) chutes_man, | ||
SAFE_CAST(REPLACE (chutes_vis,".0","") AS INT64) chutes_vis, | ||
SAFE_CAST(REPLACE (chutes_fora_man,".0","") AS INT64) chutes_fora_man, | ||
SAFE_CAST(REPLACE (chutes_fora_vis,".0","") AS INT64) chutes_fora_vis | ||
FROM basedosdados-staging.mundo_transfermarkt_competicoes_staging.brasileirao_serie_a 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