Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] br_ibge_ #272

Merged
merged 3 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion models/br_ibge_inpc/br_ibge_inpc__mes_brasil.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
{{ config(alias='mes_brasil', schema='br_ibge_inpc') }}
{{
config(
alias='mes_brasil',
schema='br_ibge_inpc',
materialized='incremental',
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:bd-pro@basedosdados.org", "group:sudo@basedosdados.org")
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,
Expand All @@ -9,3 +24,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-staging.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 %}
20 changes: 19 additions & 1 deletion models/br_ibge_inpc/br_ibge_inpc__mes_categoria_brasil.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
{{ config(alias='mes_categoria_brasil', schema='br_ibge_inpc') }}
{{
config(
alias='mes_categoria_brasil',
schema='br_ibge_inpc',
materialized='incremental',
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:bd-pro@basedosdados.org", "group:sudo@basedosdados.org")
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,
Expand All @@ -10,3 +25,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-staging.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 %}
22 changes: 20 additions & 2 deletions models/br_ibge_inpc/br_ibge_inpc__mes_categoria_municipio.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
{{ config(alias='mes_categoria_municipio', schema='br_ibge_inpc') }}
{{
config(
alias='mes_categoria_municipio',
schema='br_ibge_inpc',
materialized='incremental',
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:bd-pro@basedosdados.org", "group:sudo@basedosdados.org")
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,
Expand All @@ -10,4 +25,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-staging.br_ibge_inpc_staging.mes_categoria_municipio AS t
FROM basedosdados-staging.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 %}
22 changes: 20 additions & 2 deletions models/br_ibge_inpc/br_ibge_inpc__mes_categoria_rm.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
{{ config(alias='mes_categoria_rm', schema='br_ibge_inpc') }}
{{
config(
alias='mes_categoria_rm',
schema='br_ibge_inpc',
materialized='incremental',
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:bd-pro@basedosdados.org", "group:sudo@basedosdados.org")
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,
Expand All @@ -10,4 +25,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-staging.br_ibge_inpc_staging.mes_categoria_rm AS t
FROM basedosdados-staging.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 %}
21 changes: 20 additions & 1 deletion models/br_ibge_ipca/br_ibge_ipca__mes_brasil.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
{{ config(alias='mes_brasil', schema='br_ibge_ipca') }}
{{
config(
alias='mes_brasil',
schema='br_ibge_ipca',
materialized='incremental',
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:bd-pro@basedosdados.org", "group:sudo@basedosdados.org")
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,
Expand All @@ -9,3 +24,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-staging.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 %}
22 changes: 20 additions & 2 deletions models/br_ibge_ipca/br_ibge_ipca__mes_categoria_brasil.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
{{ config(alias='mes_categoria_brasil', schema='br_ibge_ipca') }}
{{
config(
alias='mes_categoria_brasil',
schema='br_ibge_ipca',
materialized='incremental',
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:bd-pro@basedosdados.org", "group:sudo@basedosdados.org")
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,
Expand All @@ -9,4 +24,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-staging.br_ibge_ipca_staging.mes_categoria_brasil AS t
FROM basedosdados-staging.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 %}
22 changes: 20 additions & 2 deletions models/br_ibge_ipca/br_ibge_ipca__mes_categoria_municipio.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
{{ config(alias='mes_categoria_municipio', schema='br_ibge_ipca') }}
{{
config(
alias='mes_categoria_municipio',
schema='br_ibge_ipca',
materialized='incremental',
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:bd-pro@basedosdados.org", "group:sudo@basedosdados.org")
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,
Expand All @@ -10,4 +25,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-staging.br_ibge_ipca_staging.mes_categoria_municipio AS t
FROM basedosdados-staging.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 %}
23 changes: 21 additions & 2 deletions models/br_ibge_ipca/br_ibge_ipca__mes_categoria_rm.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
{{ config(alias='mes_categoria_rm', schema='br_ibge_ipca') }}
{{
config(
alias='mes_categoria_rm',
schema='br_ibge_ipca',
materialized='incremental',
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:bd-pro@basedosdados.org", "group:sudo@basedosdados.org")
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,
Expand All @@ -10,4 +26,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-staging.br_ibge_ipca_staging.mes_categoria_rm AS t
FROM basedosdados-staging.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 %}
20 changes: 19 additions & 1 deletion models/br_ibge_ipca15/br_ibge_ipca15__mes_brasil.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
{{ config(alias='mes_brasil', schema='br_ibge_ipca15') }}
{{
config(
alias='mes_brasil',
schema='br_ibge_ipca15',
materialized='incremental',
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:bd-pro@basedosdados.org", "group:sudo@basedosdados.org")
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,
Expand All @@ -9,3 +24,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-staging.br_ibge_ipca15_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 %}
22 changes: 20 additions & 2 deletions models/br_ibge_ipca15/br_ibge_ipca15__mes_categoria_brasil.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
{{ config(alias='mes_categoria_brasil', schema='br_ibge_ipca15') }}
{{
config(
alias='mes_categoria_brasil',
schema='br_ibge_ipca15',
materialized='incremental',
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:bd-pro@basedosdados.org", "group:sudo@basedosdados.org")
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,
Expand All @@ -9,4 +24,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-staging.br_ibge_ipca15_staging.mes_categoria_brasil AS t
FROM basedosdados-staging.br_ibge_ipca15_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 %}
22 changes: 20 additions & 2 deletions models/br_ibge_ipca15/br_ibge_ipca15__mes_categoria_municipio.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
{{ config(alias='mes_categoria_municipio', schema='br_ibge_ipca15') }}
{{
config(
alias='mes_categoria_municipio',
schema='br_ibge_ipca15',
materialized='incremental',
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:bd-pro@basedosdados.org", "group:sudo@basedosdados.org")
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,
Expand All @@ -10,4 +25,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-staging.br_ibge_ipca15_staging.mes_categoria_municipio AS t
FROM basedosdados-staging.br_ibge_ipca15_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 %}
22 changes: 20 additions & 2 deletions models/br_ibge_ipca15/br_ibge_ipca15__mes_categoria_rm.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
{{ config(alias='mes_categoria_rm', schema='br_ibge_ipca15') }}
{{
config(
alias='mes_categoria_rm',
schema='br_ibge_ipca15',
materialized='incremental',
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:bd-pro@basedosdados.org", "group:sudo@basedosdados.org")
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,
Expand All @@ -10,4 +25,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-staging.br_ibge_ipca15_staging.mes_categoria_rm AS t
FROM basedosdados-staging.br_ibge_ipca15_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 %}
Loading