Skip to content

Commit

Permalink
Merge pull request #466 from basedosdados/update-mme-energia
Browse files Browse the repository at this point in the history
[fix/update] br_mme_consumo_energia_eletrica
  • Loading branch information
tricktx authored Mar 22, 2024
2 parents 0f6df6b + 3d4b04e commit 88e7e59
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@
)
}}
select
safe_cast(ano as int64) ano,
safe_cast(mes as int64) mes,
safe_cast(sigla_uf as string) sigla_uf,
safe_cast(tipo_consumo as string) tipo_consumo,
safe_cast(numero_consumidores as float64) numero_consumidores,
safe_cast(consumo as float64) consumo
safe_cast(ano as int64) as ano,
safe_cast(mes as int64) as mes,
safe_cast(sigla_uf as string) as sigla_uf,
safe_cast(tipo_consumo as string) as tipo_consumo,
case
when numero_consumidores = '0'
then null
else safe_cast(numero_consumidores as int64)
end as numero_consumidores,
safe_cast(consumo as int64) as consumo
from `basedosdados-dev.br_mme_consumo_energia_eletrica_staging.uf` as t
13 changes: 13 additions & 0 deletions models/br_mme_consumo_energia_eletrica/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,26 @@ models:
columns:
- name: ano
description: Ano
tests:
- relationships:
to: ref('br_bd_diretorios_data_tempo__ano')
field: ano.ano
- name: mes
description: Mês
tests:
- relationships:
to: ref('br_bd_diretorios_data_tempo__mes')
field: mes.mes
- name: sigla_uf
description: Sigla da Unidade da Federação
tests:
- relationships:
to: ref('br_bd_diretorios_brasil__uf')
field: sigla
- name: tipo_consumo
description: Tipo de Consumo
- name: numero_consumidores
description: Número de consumidores de energia elétrica atendidos pela rede
- name: consumo
description: Consumo de energia elétrica na rede (MWh)
tests: [not_null]

0 comments on commit 88e7e59

Please sign in to comment.