-
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 #515 from basedosdados/update-mme-energia
[update/fix] br_mme_consumo_energia_eletrica
- Loading branch information
Showing
5 changed files
with
434 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
id: cc3f54e0-fd01-4495-bd12-aa41f3b24444 |
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 |
---|---|---|
|
@@ -228,6 +228,9 @@ models: | |
+post-hook: | ||
- REVOKE `roles/bigquery.dataViewer` ON TABLE {{ this }} FROM "specialGroup:allUsers" | ||
- GRANT `roles/bigquery.dataViewer` ON TABLE {{ this }} TO "group:[email protected]" | ||
br_mme_consumo_energia_eletrica: | ||
+materialized: table | ||
+schema: br_mme_consumo_energia_eletrica | ||
br_mp_pep: | ||
+materialized: table | ||
+schema: br_mp_pep | ||
|
19 changes: 19 additions & 0 deletions
19
models/br_mme_consumo_energia_eletrica/br_mme_consumo_energia_eletrica__uf.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,19 @@ | ||
{{ | ||
config( | ||
alias="uf", | ||
schema="br_mme_consumo_energia_eletrica", | ||
materialized="table", | ||
) | ||
}} | ||
select | ||
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-staging.br_mme_consumo_energia_eletrica_staging.uf` as t |
Oops, something went wrong.