From 0367fb3a8542f844ceff5100e73a0b751b4eb87b Mon Sep 17 00:00:00 2001 From: folhesgabriel Date: Mon, 26 Feb 2024 22:09:28 -0300 Subject: [PATCH] fix: temporary remove pre hook to materialize table --- models/br_ms_cnes/br_ms_cnes__estabelecimento.sql | 6 ------ .../br_ms_cnes/br_ms_cnes__estabelecimento_filantropico.sql | 5 ----- models/br_ms_cnes/br_ms_cnes__habilitacao.sql | 2 +- 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/models/br_ms_cnes/br_ms_cnes__estabelecimento.sql b/models/br_ms_cnes/br_ms_cnes__estabelecimento.sql index bd42c3b7..853f5280 100644 --- a/models/br_ms_cnes/br_ms_cnes__estabelecimento.sql +++ b/models/br_ms_cnes/br_ms_cnes__estabelecimento.sql @@ -8,11 +8,6 @@ "data_type": "int64", "range": {"start": 2005, "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(CURRENT_DATE(),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 (True)', - ], ) }} with @@ -272,7 +267,6 @@ select from cnes_add_muni {% 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 %} diff --git a/models/br_ms_cnes/br_ms_cnes__estabelecimento_filantropico.sql b/models/br_ms_cnes/br_ms_cnes__estabelecimento_filantropico.sql index 6755b719..6eff922c 100644 --- a/models/br_ms_cnes/br_ms_cnes__estabelecimento_filantropico.sql +++ b/models/br_ms_cnes/br_ms_cnes__estabelecimento_filantropico.sql @@ -8,11 +8,6 @@ "data_type": "int64", "range": {"start": 2005, "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(CURRENT_DATE(),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 (True)', - ], ) }} with diff --git a/models/br_ms_cnes/br_ms_cnes__habilitacao.sql b/models/br_ms_cnes/br_ms_cnes__habilitacao.sql index 36ef2eae..dbada63f 100644 --- a/models/br_ms_cnes/br_ms_cnes__habilitacao.sql +++ b/models/br_ms_cnes/br_ms_cnes__habilitacao.sql @@ -19,7 +19,7 @@ with raw_cnes_habilitacaol as ( -- 1. Retirar linhas com id_estabelecimento_cnes nulo select * - from `basedosdados-dev.br_ms_cnes_staging.habilitacao` + from `basedosdados-staging.br_ms_cnes_staging.habilitacao` where cnes is not null ), raw_cnes_habilitacao_without_duplicates as (