-
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 #264 from basedosdados/removing-atualizado-tables
[feat] removing `_atualizado` tables
- Loading branch information
Showing
25 changed files
with
137 additions
and
400 deletions.
There are no files selected for viewing
15 changes: 12 additions & 3 deletions
15
models/br_anatel_banda_larga_fixa/br_anatel_banda_larga_fixa__densidade_brasil.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,9 +1,18 @@ | ||
{{ config(alias='densidade_brasil', schema='br_anatel_banda_larga_fixa') }} | ||
{{ config(alias='densidade_brasil', schema='br_anatel_banda_larga_fixa', | ||
post_hook = [ | ||
'CREATE OR REPLACE ROW ACCESS POLICY allusers_filter | ||
ON {{this}} | ||
GRANT TO ("allUsers") | ||
FILTER USING (DATE_DIFF(DATE("{{ run_started_at.strftime("%Y-%m-%d") }}"),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)', | ||
'CREATE OR REPLACE ROW ACCESS POLICY bdpro_filter | ||
ON {{this}} | ||
GRANT TO ("group:[email protected]", "group:[email protected]") | ||
FILTER USING (DATE_DIFF(DATE("{{ run_started_at.strftime("%Y-%m-%d") }}"),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)'] ) }} | ||
|
||
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 | ||
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) |
11 changes: 0 additions & 11 deletions
11
...ls/br_anatel_banda_larga_fixa/br_anatel_banda_larga_fixa__densidade_brasil_atualizado.sql
This file was deleted.
Oops, something went wrong.
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,6 +1,17 @@ | ||
{{ config( | ||
alias='densidade_municipio', | ||
schema='br_anatel_banda_larga_fixa') | ||
schema='br_anatel_banda_larga_fixa', | ||
post_hook = [ | ||
'CREATE OR REPLACE ROW ACCESS POLICY allusers_filter | ||
ON {{this}} | ||
GRANT TO ("allUsers") | ||
FILTER USING (DATE_DIFF(DATE("{{ run_started_at.strftime("%Y-%m-%d") }}"),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)', | ||
'CREATE OR REPLACE ROW ACCESS POLICY bdpro_filter | ||
ON {{this}} | ||
GRANT TO ("group:[email protected]", "group:[email protected]") | ||
FILTER USING (DATE_DIFF(DATE("{{ run_started_at.strftime("%Y-%m-%d") }}"),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)'] ) | ||
}} | ||
|
||
SELECT | ||
|
@@ -9,6 +20,4 @@ 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 | ||
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) | ||
FROM basedosdados-staging.br_anatel_banda_larga_fixa_staging.densidade_municipio AS t |
15 changes: 0 additions & 15 deletions
15
...br_anatel_banda_larga_fixa/br_anatel_banda_larga_fixa__densidade_municipio_atualizado.sql
This file was deleted.
Oops, something went wrong.
15 changes: 12 additions & 3 deletions
15
models/br_anatel_banda_larga_fixa/br_anatel_banda_larga_fixa__densidade_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 |
---|---|---|
@@ -1,10 +1,19 @@ | ||
{{ config(alias='densidade_uf', schema='br_anatel_banda_larga_fixa') }} | ||
{{ config(alias='densidade_uf', schema='br_anatel_banda_larga_fixa', | ||
post_hook = [ | ||
'CREATE OR REPLACE ROW ACCESS POLICY allusers_filter | ||
ON {{this}} | ||
GRANT TO ("allUsers") | ||
FILTER USING (DATE_DIFF(DATE("{{ run_started_at.strftime("%Y-%m-%d") }}"),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)', | ||
'CREATE OR REPLACE ROW ACCESS POLICY bdpro_filter | ||
ON {{this}} | ||
GRANT TO ("group:[email protected]", "group:[email protected]") | ||
FILTER USING (DATE_DIFF(DATE("{{ run_started_at.strftime("%Y-%m-%d") }}"),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)'] ) }} | ||
|
||
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 | ||
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) |
11 changes: 0 additions & 11 deletions
11
models/br_anatel_banda_larga_fixa/br_anatel_banda_larga_fixa__densidade_uf_atualizado.sql
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -11,7 +11,18 @@ | |
"interval": 1} | ||
}, | ||
cluster_by = ["id_municipio", "mes"], | ||
labels = {'project_id': 'basedosdados'}) | ||
labels = {'project_id': 'basedosdados'}, | ||
post_hook = [ | ||
'CREATE OR REPLACE ROW ACCESS POLICY allusers_filter | ||
ON {{this}} | ||
GRANT TO ("allUsers") | ||
FILTER USING (DATE_DIFF(DATE("{{ run_started_at.strftime("%Y-%m-%d") }}"),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)', | ||
'CREATE OR REPLACE ROW ACCESS POLICY bdpro_filter | ||
ON {{this}} | ||
GRANT TO ("group:[email protected]", "group:[email protected]") | ||
FILTER USING (DATE_DIFF(DATE("{{ run_started_at.strftime("%Y-%m-%d") }}"),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)'] ) | ||
}} | ||
|
||
SELECT | ||
|
@@ -27,6 +38,4 @@ 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 | ||
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) | ||
FROM basedosdados-staging.br_anatel_banda_larga_fixa_staging.microdados AS t |
34 changes: 0 additions & 34 deletions
34
models/br_anatel_banda_larga_fixa/br_anatel_banda_larga_fixa__microdados_atualizado.sql
This file was deleted.
Oops, something went wrong.
14 changes: 11 additions & 3 deletions
14
models/br_anatel_telefonia_movel/br_anatel_telefonia_movel__densidade_brasil.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,9 +1,17 @@ | ||
{{ config(alias='densidade_brasil', schema='br_anatel_telefonia_movel') }} | ||
{{ config(alias='densidade_brasil', schema='br_anatel_telefonia_movel', | ||
post_hook = [ | ||
'CREATE OR REPLACE ROW ACCESS POLICY allusers_filter | ||
ON {{this}} | ||
GRANT TO ("allUsers") | ||
FILTER USING (DATE_DIFF(DATE("{{ run_started_at.strftime("%Y-%m-%d") }}"),DATE(CAST(ano AS INT64),CAST(mes AS INT64),1), MONTH) > 6)', | ||
'CREATE OR REPLACE ROW ACCESS POLICY bdpro_filter | ||
ON {{this}} | ||
GRANT TO ("group:[email protected]", "group:[email protected]") | ||
FILTER USING (DATE_DIFF(DATE("{{ run_started_at.strftime("%Y-%m-%d") }}"),DATE(CAST(ano AS INT64),CAST(mes AS INT64),1), MONTH) <= 6)'] ) }} | ||
|
||
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 | ||
WHERE DATE_DIFF(CURRENT_DATE(),DATE(CAST(ano AS INT64),CAST(mes AS INT64),1), MONTH) > 6 | ||
|
11 changes: 0 additions & 11 deletions
11
models/br_anatel_telefonia_movel/br_anatel_telefonia_movel__densidade_brasil_atualizado.sql
This file was deleted.
Oops, something went wrong.
14 changes: 11 additions & 3 deletions
14
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,11 +1,19 @@ | ||
{{ config(alias='densidade_municipio', schema='br_anatel_telefonia_movel') }} | ||
{{ config(alias='densidade_municipio', schema='br_anatel_telefonia_movel', | ||
post_hook = [ | ||
'CREATE OR REPLACE ROW ACCESS POLICY allusers_filter | ||
ON {{this}} | ||
GRANT TO ("allUsers") | ||
FILTER USING (DATE_DIFF(DATE("{{ run_started_at.strftime("%Y-%m-%d") }}"),DATE(CAST(ano AS INT64),CAST(mes AS INT64),1), MONTH) > 6)', | ||
'CREATE OR REPLACE ROW ACCESS POLICY bdpro_filter | ||
ON {{this}} | ||
GRANT TO ("group:[email protected]", "group:[email protected]") | ||
FILTER USING (DATE_DIFF(DATE("{{ run_started_at.strftime("%Y-%m-%d") }}"),DATE(CAST(ano AS INT64),CAST(mes AS INT64),1), MONTH) <= 6)']) }} | ||
|
||
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(CAST(ano AS INT64),CAST(mes AS INT64),1), MONTH) > 6 | ||
|
14 changes: 0 additions & 14 deletions
14
...s/br_anatel_telefonia_movel/br_anatel_telefonia_movel__densidade_municipio_atualizado.sql
This file was deleted.
Oops, something went wrong.
17 changes: 12 additions & 5 deletions
17
models/br_anatel_telefonia_movel/br_anatel_telefonia_movel__densidade_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 |
---|---|---|
@@ -1,10 +1,17 @@ | ||
{{ config(alias='densidade_uf', schema='br_anatel_telefonia_movel') }} | ||
|
||
{{ config(alias='densidade_uf', schema='br_anatel_telefonia_movel', | ||
post_hook = [ | ||
'CREATE OR REPLACE ROW ACCESS POLICY allusers_filter | ||
ON {{this}} | ||
GRANT TO ("allUsers") | ||
FILTER USING (DATE_DIFF(DATE("{{ run_started_at.strftime("%Y-%m-%d") }}"),DATE(CAST(ano AS INT64),CAST(mes AS INT64),1), MONTH) > 6)', | ||
'CREATE OR REPLACE ROW ACCESS POLICY bdpro_filter | ||
ON {{this}} | ||
GRANT TO ("group:[email protected]", "group:[email protected]") | ||
FILTER USING (DATE_DIFF(DATE("{{ run_started_at.strftime("%Y-%m-%d") }}"),DATE(CAST(ano AS INT64),CAST(mes AS INT64),1), MONTH) <= 6)']) }} | ||
|
||
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 | ||
WHERE DATE_DIFF(CURRENT_DATE(),DATE(CAST(ano AS INT64),CAST(mes AS INT64),1), MONTH) > 6 | ||
FROM basedosdados-staging.br_anatel_telefonia_movel_staging.densidade_uf AS t |
11 changes: 0 additions & 11 deletions
11
models/br_anatel_telefonia_movel/br_anatel_telefonia_movel__densidade_uf_atualizado.sql
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -11,7 +11,16 @@ | |
"interval": 1} | ||
}, | ||
cluster_by = ["id_municipio", "mes"], | ||
labels = {'project_id': 'basedosdados'}) | ||
labels = {'project_id': 'basedosdados'}, | ||
post_hook = [ | ||
'CREATE OR REPLACE ROW ACCESS POLICY allusers_filter | ||
ON {{this}} | ||
GRANT TO ("allUsers") | ||
FILTER USING (DATE_DIFF(DATE("{{ run_started_at.strftime("%Y-%m-%d") }}"),DATE(CAST(ano AS INT64),CAST(mes AS INT64),1), MONTH) > 6)', | ||
'CREATE OR REPLACE ROW ACCESS POLICY bdpro_filter | ||
ON {{this}} | ||
GRANT TO ("group:[email protected]", "group:[email protected]") | ||
FILTER USING (DATE_DIFF(DATE("{{ run_started_at.strftime("%Y-%m-%d") }}"),DATE(CAST(ano AS INT64),CAST(mes AS INT64),1), MONTH) <= 6)']) | ||
}} | ||
|
||
|
||
|
@@ -30,6 +39,5 @@ SAFE_CAST(modalidade AS STRING) modalidade, | |
SAFE_CAST(pessoa AS STRING) pessoa, | ||
SAFE_CAST(produto AS STRING) produto, | ||
SAFE_CAST(acessos AS INT64) acessos | ||
|
||
FROM basedosdados-staging.br_anatel_telefonia_movel_staging.microdados AS t | ||
WHERE DATE_DIFF(CURRENT_DATE(),DATE(CAST(ano AS INT64),CAST(mes AS INT64),1), MONTH) > 6 | ||
|
36 changes: 0 additions & 36 deletions
36
models/br_anatel_telefonia_movel/br_anatel_telefonia_movel__microdados_atualizado.sql
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -11,7 +11,16 @@ | |
"interval": 1} | ||
}, | ||
cluster_by = ["mes", "sigla_uf"], | ||
labels = {'project_id': 'basedosdados', 'tema': 'economia'}) | ||
labels = {'project_id': 'basedosdados', 'tema': 'economia'}, | ||
post_hook = [ | ||
'CREATE OR REPLACE ROW ACCESS POLICY allusers_filter | ||
ON {{this}} | ||
GRANT TO ("allUsers") | ||
FILTER USING (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)', | ||
'CREATE OR REPLACE ROW ACCESS POLICY bdpro_filter | ||
ON {{this}} | ||
GRANT TO ("group:[email protected]", "group:[email protected]") | ||
FILTER USING (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)'] ) | ||
}} | ||
SELECT | ||
SAFE_CAST(ano AS INT64) ano, | ||
|
@@ -23,5 +32,3 @@ SAFE_CAST(id_municipio AS STRING) id_municipio, | |
SAFE_CAST(peso_liquido_kg AS INT64) peso_liquido_kg, | ||
SAFE_CAST(valor_fob_dolar AS INT64) valor_fob_dolar | ||
FROM basedosdados-staging.br_me_comex_stat_staging.municipio_exportacao 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) |
Oops, something went wrong.