diff --git a/models/br_bcb_agencia/br_bcb_agencia__agencia.sql b/models/br_bcb_agencia/br_bcb_agencia__agencia.sql index 56811497..e696aa07 100644 --- a/models/br_bcb_agencia/br_bcb_agencia__agencia.sql +++ b/models/br_bcb_agencia/br_bcb_agencia__agencia.sql @@ -9,10 +9,6 @@ "range": {"start": 2007, "end": 2025, "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 (DATE_DIFF(CURRENT_DATE(),DATE(CAST(ano AS INT64),CAST(mes AS INT64),1), MONTH) <= 6)', - ], ) }} @@ -229,8 +225,6 @@ select from wrang_data {% if is_incremental() %} where - date(cast(ano as int64), cast(mes as int64), 1) not in ( - select distinct (date(cast(ano as int64), cast(mes as int64), 1)) - from {{ this }} - ) + 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 %}