-
Notifications
You must be signed in to change notification settings - Fork 1
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 #306 from basedosdados/fix_ibge
[dbt] br_ibge_
- Loading branch information
Showing
19 changed files
with
379 additions
and
21 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
models/br_fgv_igp/igp_10_mes.sql → models/br_fgv_igp/br_fgv_igp__igp_10_mes.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
6 changes: 6 additions & 0 deletions
6
models/br_fgv_igp/igp_di_ano.sql → models/br_fgv_igp/br_fgv_igp__igp_di_ano.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
6 changes: 6 additions & 0 deletions
6
models/br_fgv_igp/igp_m_ano.sql → models/br_fgv_igp/br_fgv_igp__igp_m_ano.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
7 changes: 7 additions & 0 deletions
7
models/br_fgv_igp/igp_m_mes.sql → models/br_fgv_igp/br_fgv_igp__igp_m_mes.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
6 changes: 6 additions & 0 deletions
6
models/br_fgv_igp/igp_og_ano.sql → models/br_fgv_igp/br_fgv_igp__igp_og_ano.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
7 changes: 7 additions & 0 deletions
7
models/br_fgv_igp/igp_og_mes.sql → models/br_fgv_igp/br_fgv_igp__igp_og_mes.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,27 @@ | ||
{{ config(alias='mes_brasil', schema='br_ibge_inpc') }} | ||
{{ | ||
config( | ||
alias='mes_brasil', | ||
schema='br_ibge_inpc', | ||
materialized='incremental', | ||
partition_by = { | ||
"field": "ano", | ||
"data_type": "int64", | ||
"range": { | ||
"start": 1979, | ||
"end": 2024, | ||
"interval": 1} | ||
}, | ||
pre_hook = "DROP ALL ROW ACCESS POLICIES ON {{ this }}", | ||
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, | ||
|
@@ -9,3 +32,6 @@ SAFE_CAST(variacao_semestral AS FLOAT64) variacao_semestral, | |
SAFE_CAST(variacao_anual AS FLOAT64) variacao_anual, | ||
SAFE_CAST(variacao_doze_meses AS FLOAT64) variacao_doze_meses | ||
FROM basedosdados-dev.br_ibge_inpc_staging.mes_brasil AS t | ||
{% if is_incremental() %} | ||
WHERE DATE(CAST(ano AS INT64),CAST(mes AS INT64),1) > (SELECT MAX(DATE(CAST(ano AS INT64),CAST(mes AS INT64),1)) FROM {{ this }} ) | ||
{% endif %} |
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,4 +1,27 @@ | ||
{{ config(alias='mes_categoria_brasil', schema='br_ibge_inpc') }} | ||
{{ | ||
config( | ||
alias='mes_categoria_brasil', | ||
schema='br_ibge_inpc', | ||
materialized='incremental', | ||
partition_by = { | ||
"field": "ano", | ||
"data_type": "int64", | ||
"range": { | ||
"start": 2000, | ||
"end": 2024, | ||
"interval": 1} | ||
}, | ||
pre_hook = "DROP ALL ROW ACCESS POLICIES ON {{ this }}", | ||
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, | ||
|
@@ -10,3 +33,6 @@ SAFE_CAST(variacao_mensal AS FLOAT64) variacao_mensal, | |
SAFE_CAST(variacao_anual AS FLOAT64) variacao_anual, | ||
SAFE_CAST(variacao_doze_meses AS FLOAT64) variacao_doze_meses | ||
FROM basedosdados-dev.br_ibge_inpc_staging.mes_categoria_brasil AS t | ||
{% if is_incremental() %} | ||
WHERE DATE(CAST(ano AS INT64),CAST(mes AS INT64),1) > (SELECT MAX(DATE(CAST(ano AS INT64),CAST(mes AS INT64),1)) FROM {{ this }} ) | ||
{% endif %} |
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,4 +1,27 @@ | ||
{{ config(alias='mes_categoria_municipio', schema='br_ibge_inpc') }} | ||
{{ | ||
config( | ||
alias='mes_categoria_municipio', | ||
schema='br_ibge_inpc', | ||
materialized='incremental', | ||
partition_by = { | ||
"field": "ano", | ||
"data_type": "int64", | ||
"range": { | ||
"start": 2000, | ||
"end": 2024, | ||
"interval": 1} | ||
}, | ||
pre_hook = "DROP ALL ROW ACCESS POLICIES ON {{ this }}", | ||
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, | ||
|
@@ -10,4 +33,7 @@ SAFE_CAST(peso_mensal AS FLOAT64) peso_mensal, | |
SAFE_CAST(variacao_mensal AS FLOAT64) variacao_mensal, | ||
SAFE_CAST(variacao_anual AS FLOAT64) variacao_anual, | ||
SAFE_CAST(variacao_doze_meses AS FLOAT64) variacao_doze_meses | ||
FROM basedosdados-dev.br_ibge_inpc_staging.mes_categoria_municipio AS t | ||
FROM basedosdados-dev.br_ibge_inpc_staging.mes_categoria_municipio AS t | ||
{% if is_incremental() %} | ||
WHERE DATE(CAST(ano AS INT64),CAST(mes AS INT64),1) > (SELECT MAX(DATE(CAST(ano AS INT64),CAST(mes AS INT64),1)) FROM {{ this }} ) | ||
{% endif %} |
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,4 +1,27 @@ | ||
{{ config(alias='mes_categoria_rm', schema='br_ibge_inpc') }} | ||
{{ | ||
config( | ||
alias='mes_categoria_rm', | ||
schema='br_ibge_inpc', | ||
materialized='incremental', | ||
partition_by = { | ||
"field": "ano", | ||
"data_type": "int64", | ||
"range": { | ||
"start": 2000, | ||
"end": 2024, | ||
"interval": 1} | ||
}, | ||
pre_hook = "DROP ALL ROW ACCESS POLICIES ON {{ this }}", | ||
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, | ||
|
@@ -10,4 +33,7 @@ SAFE_CAST(peso_mensal AS FLOAT64) peso_mensal, | |
SAFE_CAST(variacao_mensal AS FLOAT64) variacao_mensal, | ||
SAFE_CAST(variacao_anual AS FLOAT64) variacao_anual, | ||
SAFE_CAST(variacao_doze_meses AS FLOAT64) variacao_doze_meses | ||
FROM basedosdados-dev.br_ibge_inpc_staging.mes_categoria_rm AS t | ||
FROM basedosdados-dev.br_ibge_inpc_staging.mes_categoria_rm AS t | ||
{% if is_incremental() %} | ||
WHERE DATE(CAST(ano AS INT64),CAST(mes AS INT64),1) > (SELECT MAX(DATE(CAST(ano AS INT64),CAST(mes AS INT64),1)) FROM {{ this }} ) | ||
{% endif %} |
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,4 +1,27 @@ | ||
{{ config(alias='mes_brasil', schema='br_ibge_ipca') }} | ||
{{ | ||
config( | ||
alias='mes_brasil', | ||
schema='br_ibge_ipca', | ||
materialized='incremental', | ||
partition_by = { | ||
"field": "ano", | ||
"data_type": "int64", | ||
"range": { | ||
"start": 1979, | ||
"end": 2024, | ||
"interval": 1} | ||
}, | ||
pre_hook = "DROP ALL ROW ACCESS POLICIES ON {{ this }}", | ||
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, | ||
|
@@ -9,3 +32,7 @@ SAFE_CAST(variacao_semestral AS FLOAT64) variacao_semestral, | |
SAFE_CAST(variacao_anual AS FLOAT64) variacao_anual, | ||
SAFE_CAST(variacao_doze_meses AS FLOAT64) variacao_doze_meses | ||
FROM basedosdados-dev.br_ibge_ipca_staging.mes_brasil AS t | ||
|
||
{% if is_incremental() %} | ||
WHERE DATE(CAST(ano AS INT64),CAST(mes AS INT64),1) > (SELECT MAX(DATE(CAST(ano AS INT64),CAST(mes AS INT64),1)) FROM {{ this }} ) | ||
{% endif %} |
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,4 +1,27 @@ | ||
{{ config(alias='mes_categoria_brasil', schema='br_ibge_ipca') }} | ||
{{ | ||
config( | ||
alias='mes_categoria_brasil', | ||
schema='br_ibge_ipca', | ||
materialized='incremental', | ||
partition_by = { | ||
"field": "ano", | ||
"data_type": "int64", | ||
"range": { | ||
"start": 2020, | ||
"end": 2024, | ||
"interval": 1} | ||
}, | ||
pre_hook = "DROP ALL ROW ACCESS POLICIES ON {{ this }}", | ||
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, | ||
|
@@ -9,4 +32,7 @@ SAFE_CAST(peso_mensal AS FLOAT64) peso_mensal, | |
SAFE_CAST(variacao_mensal AS FLOAT64) variacao_mensal, | ||
SAFE_CAST(variacao_anual AS FLOAT64) variacao_anual, | ||
SAFE_CAST(variacao_doze_meses AS FLOAT64) variacao_doze_meses | ||
FROM basedosdados-dev.br_ibge_ipca_staging.mes_categoria_brasil AS t | ||
FROM basedosdados-dev.br_ibge_ipca_staging.mes_categoria_brasil AS t | ||
{% if is_incremental() %} | ||
WHERE DATE(CAST(ano AS INT64),CAST(mes AS INT64),1) > (SELECT MAX(DATE(CAST(ano AS INT64),CAST(mes AS INT64),1)) FROM {{ this }} ) | ||
{% endif %} |
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,4 +1,27 @@ | ||
{{ config(alias='mes_categoria_municipio', schema='br_ibge_ipca') }} | ||
{{ | ||
config( | ||
alias='mes_categoria_municipio', | ||
schema='br_ibge_ipca', | ||
materialized='incremental', | ||
partition_by = { | ||
"field": "ano", | ||
"data_type": "int64", | ||
"range": { | ||
"start": 2020, | ||
"end": 2024, | ||
"interval": 1} | ||
}, | ||
pre_hook = "DROP ALL ROW ACCESS POLICIES ON {{ this }}", | ||
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, | ||
|
@@ -10,4 +33,7 @@ SAFE_CAST(peso_mensal AS FLOAT64) peso_mensal, | |
SAFE_CAST(variacao_mensal AS FLOAT64) variacao_mensal, | ||
SAFE_CAST(variacao_anual AS FLOAT64) variacao_anual, | ||
SAFE_CAST(variacao_doze_meses AS FLOAT64) variacao_doze_meses | ||
FROM basedosdados-dev.br_ibge_ipca_staging.mes_categoria_municipio AS t | ||
FROM basedosdados-dev.br_ibge_ipca_staging.mes_categoria_municipio AS t | ||
{% if is_incremental() %} | ||
WHERE DATE(CAST(ano AS INT64),CAST(mes AS INT64),1) > (SELECT MAX(DATE(CAST(ano AS INT64),CAST(mes AS INT64),1)) FROM {{ this }} ) | ||
{% endif %} |
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,4 +1,28 @@ | ||
{{ config(alias='mes_categoria_rm', schema='br_ibge_ipca') }} | ||
{{ | ||
config( | ||
alias='mes_categoria_rm', | ||
schema='br_ibge_ipca', | ||
materialized='incremental', | ||
partition_by = { | ||
"field": "ano", | ||
"data_type": "int64", | ||
"range": { | ||
"start": 2020, | ||
"end": 2024, | ||
"interval": 1} | ||
}, | ||
pre_hook = "DROP ALL ROW ACCESS POLICIES ON {{ this }}", | ||
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, | ||
|
@@ -10,4 +34,7 @@ SAFE_CAST(peso_mensal AS FLOAT64) peso_mensal, | |
SAFE_CAST(variacao_mensal AS FLOAT64) variacao_mensal, | ||
SAFE_CAST(variacao_anual AS FLOAT64) variacao_anual, | ||
SAFE_CAST(variacao_doze_meses AS FLOAT64) variacao_doze_meses | ||
FROM basedosdados-dev.br_ibge_ipca_staging.mes_categoria_rm AS t | ||
FROM basedosdados-dev.br_ibge_ipca_staging.mes_categoria_rm AS t | ||
{% if is_incremental() %} | ||
WHERE DATE(CAST(ano AS INT64),CAST(mes AS INT64),1) > (SELECT MAX(DATE(CAST(ano AS INT64),CAST(mes AS INT64),1)) FROM {{ this }} ) | ||
{% endif %} |
Oops, something went wrong.