-
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 branch 'master' into staging/br_bd_diretorios_brasil.cep
- Loading branch information
Showing
27 changed files
with
635 additions
and
100 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
11 changes: 11 additions & 0 deletions
11
...ls/br_anatel_banda_larga_fixa/br_anatel_banda_larga_fixa__densidade_brasil_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,11 @@ | ||
{{ config(alias='densidade_brasil_atualizado', schema='br_anatel_banda_larga_fixa', | ||
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(ano AS INT64) ano, | ||
SAFE_CAST(mes AS INT64) mes, | ||
SAFE_CAST(densidade AS FLOAT64) densidade | ||
|
||
FROM basedosdados-staging.br_anatel_banda_larga_fixa_staging.densidade_brasil AS t | ||
|
10 changes: 7 additions & 3 deletions
10
models/br_anatel_banda_larga_fixa/br_anatel_banda_larga_fixa__densidade_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 |
---|---|---|
@@ -1,10 +1,14 @@ | ||
{{ config(alias='densidade_municipio', schema='br_anatel_banda_larga_fixa') }} | ||
{{ config( | ||
alias='densidade_municipio', | ||
schema='br_anatel_banda_larga_fixa') | ||
}} | ||
|
||
SELECT | ||
SAFE_CAST(ano AS INT64) ano, | ||
SAFE_CAST(mes AS INT64) mes, | ||
SAFE_CAST(sigla_uf AS STRING) sigla_uf, | ||
SAFE_CAST(id_municipio AS STRING) id_municipio, | ||
SAFE_CAST(densidade AS FLOAT64) densidade | ||
|
||
FROM basedosdados-staging.br_anatel_banda_larga_fixa_staging.densidade_municipio AS t | ||
FROM basedosdados-staging.br_anatel_banda_larga_fixa_staging.densidade_municipio AS t | ||
WHERE (DATE_DIFF(CURRENT_DATE(),DATE(CAST(ano AS INT64),CAST(mes AS INT64),1), MONTH) > 6 | ||
OR DATE_DIFF(DATE(2023,5,1),DATE(CAST(ano AS INT64),CAST(mes AS INT64),1), MONTH) > 0) |
15 changes: 15 additions & 0 deletions
15
...br_anatel_banda_larga_fixa/br_anatel_banda_larga_fixa__densidade_municipio_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,15 @@ | ||
{{ config(alias='densidade_municipio_atualizado', schema='br_anatel_banda_larga_fixa', | ||
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(ano AS INT64) ano, | ||
SAFE_CAST(mes AS INT64) mes, | ||
SAFE_CAST(sigla_uf AS STRING) sigla_uf, | ||
REPLACE(CAST(id_municipio AS STRING), '.0', '') id_municipio, | ||
SAFE_CAST(densidade AS FLOAT64) densidade | ||
|
||
FROM basedosdados-staging.br_anatel_banda_larga_fixa_staging.densidade_municipio 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
11 changes: 11 additions & 0 deletions
11
models/br_anatel_banda_larga_fixa/br_anatel_banda_larga_fixa__densidade_uf_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,11 @@ | ||
{{ config(alias='densidade_uf_atualizado', schema='br_anatel_banda_larga_fixa', | ||
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(ano AS INT64) ano, | ||
SAFE_CAST(mes AS INT64) mes, | ||
SAFE_CAST(sigla_uf AS STRING) sigla_uf, | ||
SAFE_CAST(densidade AS FLOAT64) densidade | ||
FROM basedosdados-staging.br_anatel_banda_larga_fixa_staging.densidade_uf 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
34 changes: 34 additions & 0 deletions
34
models/br_anatel_banda_larga_fixa/br_anatel_banda_larga_fixa__microdados_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,34 @@ | ||
{{ config( | ||
alias='microdados_atualizado', | ||
schema='br_anatel_banda_larga_fixa', | ||
materialized='table', | ||
partition_by={ | ||
"field": "ano", | ||
"data_type": "int64", | ||
"range": { | ||
"start": 2007, | ||
"end": 2023, | ||
"interval": 1} | ||
}, | ||
cluster_by = ["id_municipio", "mes"], | ||
labels = {'project_id': 'basedosdados'}, | ||
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(ano AS INT64) ano, | ||
SAFE_CAST(mes AS INT64) mes, | ||
SAFE_CAST(sigla_uf AS STRING) sigla_uf, | ||
SAFE_CAST(id_municipio AS STRING) id_municipio, | ||
SAFE_CAST(cnpj AS STRING) cnpj, | ||
SAFE_CAST(empresa AS STRING) empresa, | ||
SAFE_CAST(porte_empresa AS STRING) porte_empresa, | ||
SAFE_CAST(tecnologia AS STRING) tecnologia, | ||
SAFE_CAST(transmissao AS STRING) transmissao, | ||
SAFE_CAST(velocidade AS STRING) velocidade, | ||
SAFE_CAST(produto AS STRING) produto, | ||
SAFE_CAST(acessos AS INT64) acessos | ||
|
||
FROM basedosdados-staging.br_anatel_banda_larga_fixa_staging.microdados 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
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
5 changes: 3 additions & 2 deletions
5
models/br_anatel_telefonia_movel/br_anatel_telefonia_movel__densidade_brasil_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 |
---|---|---|
@@ -1,10 +1,11 @@ | ||
{{ config(alias='densidade_brasil_atualizado', schema='br_anatel_telefonia_movel', | ||
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(ano AS INT64) ano, | ||
SAFE_CAST(mes AS INT64) mes, | ||
SAFE_CAST(densidade AS FLOAT64) densidade | ||
|
||
FROM basedosdados-staging.br_anatel_telefonia_movel_staging.densidade_brasil AS t | ||
FROM basedosdados-staging.br_anatel_telefonia_movel_staging.densidade_brasil AS t | ||
|
21 changes: 3 additions & 18 deletions
21
models/br_anatel_telefonia_movel/br_anatel_telefonia_movel__densidade_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 |
---|---|---|
@@ -1,26 +1,11 @@ | ||
{{ config( | ||
alias='densidade_municipio', | ||
schema='br_anatel_telefonia_movel', | ||
materialized='table', | ||
partition_by={ | ||
"field": "ano", | ||
"data_type": "int64", | ||
"range": { | ||
"start": 2019, | ||
"end": 2023, | ||
"interval": 1} | ||
}, | ||
cluster_by = ["id_municipio", "mes"], | ||
labels = {'project_id': 'basedosdados'}) | ||
}} | ||
|
||
SELECT | ||
{{ config(alias='densidade_municipio', schema='br_anatel_telefonia_movel') }} | ||
|
||
SELECT | ||
SAFE_CAST(ano AS INT64) ano, | ||
SAFE_CAST(mes AS INT64) mes, | ||
SAFE_CAST(sigla_uf AS STRING) sigla_uf, | ||
REPLACE(CAST(id_municipio AS STRING), '.0', '') id_municipio, | ||
SAFE_CAST(densidade AS FLOAT64) densidade | ||
|
||
FROM basedosdados-staging.br_anatel_telefonia_movel_staging.densidade_municipio AS t | ||
WHERE DATE_DIFF(CURRENT_DATE(),DATE(SAFE_CAST(ano AS INT64),SAFE_CAST(mes AS INT64),01),month) >= 6 | ||
WHERE DATE_DIFF(CURRENT_DATE(),DATE(CAST(ano AS INT64),CAST(mes AS INT64),1), MONTH) > 6 |
20 changes: 3 additions & 17 deletions
20
...s/br_anatel_telefonia_movel/br_anatel_telefonia_movel__densidade_municipio_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
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
5 changes: 3 additions & 2 deletions
5
models/br_anatel_telefonia_movel/br_anatel_telefonia_movel__densidade_uf_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 |
---|---|---|
@@ -1,10 +1,11 @@ | ||
{{ config(alias='densidade_uf_atualizado', schema='br_anatel_telefonia_movel', | ||
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(ano AS INT64) ano, | ||
SAFE_CAST(mes AS INT64) mes, | ||
SAFE_CAST(sigla_uf AS STRING) sigla_uf, | ||
SAFE_CAST(densidade AS FLOAT64) densidade | ||
FROM basedosdados-staging.br_anatel_telefonia_movel_staging.densidade_uf AS t | ||
FROM basedosdados-staging.br_anatel_telefonia_movel_staging.densidade_uf 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
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
Oops, something went wrong.