From 8344e431a02db211e9c9e13abb4bc10ea77633d0 Mon Sep 17 00:00:00 2001 From: folhesgabriel Date: Tue, 27 Feb 2024 11:59:11 -0300 Subject: [PATCH] fix: reinsert prehook --- models/br_ms_cnes/br_ms_cnes__leito.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/models/br_ms_cnes/br_ms_cnes__leito.sql b/models/br_ms_cnes/br_ms_cnes__leito.sql index 06f7dcc2..2d86ab0c 100644 --- a/models/br_ms_cnes/br_ms_cnes__leito.sql +++ b/models/br_ms_cnes/br_ms_cnes__leito.sql @@ -8,6 +8,11 @@ "data_type": "int64", "range": {"start": 2007, "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)', + ], ) }}