From 0e708ad7f6037025b827768ac995f9fb67489167 Mon Sep 17 00:00:00 2001 From: folhesgabriel Date: Mon, 26 Feb 2024 22:34:26 -0300 Subject: [PATCH] fix: reinsert pre hook --- models/br_ms_cnes/br_ms_cnes__estabelecimento.sql | 5 +++++ .../br_ms_cnes/br_ms_cnes__estabelecimento_filantropico.sql | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/models/br_ms_cnes/br_ms_cnes__estabelecimento.sql b/models/br_ms_cnes/br_ms_cnes__estabelecimento.sql index 853f5280..46df46c2 100644 --- a/models/br_ms_cnes/br_ms_cnes__estabelecimento.sql +++ b/models/br_ms_cnes/br_ms_cnes__estabelecimento.sql @@ -8,6 +8,11 @@ "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__estabelecimento_filantropico.sql b/models/br_ms_cnes/br_ms_cnes__estabelecimento_filantropico.sql index 6eff922c..6755b719 100644 --- a/models/br_ms_cnes/br_ms_cnes__estabelecimento_filantropico.sql +++ b/models/br_ms_cnes/br_ms_cnes__estabelecimento_filantropico.sql @@ -8,6 +8,11 @@ "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