Skip to content

Commit

Permalink
feat: update configs
Browse files Browse the repository at this point in the history
  • Loading branch information
folhesgabriel committed Nov 12, 2024
1 parent d993bcf commit 37372da
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
7 changes: 2 additions & 5 deletions models/br_me_cnpj/br_me_cnpj__empresas.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
"data_type": "date",
},
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(data), MONTH) > 6)',
'CREATE OR REPLACE ROW ACCESS POLICY bdpro_filter ON {{this}} GRANT TO ("group:[email protected]", "group:[email protected]") FILTER USING (DATE_DIFF(DATE("{{ run_started_at.strftime("%Y-%m-%d") }}"),DATE(data), MONTH) <= 6)',
],
incremental_strategy="insert_overwrite",
)
}}
with
Expand All @@ -31,4 +28,4 @@ with
)
select *
from cnpj_empresas
{% if is_incremental() %} where data > '2024-09-01' {% endif %}
{% if is_incremental() %} where data in ('2024-09-18', '2024-10-16') {% endif %}
7 changes: 2 additions & 5 deletions models/br_me_cnpj/br_me_cnpj__estabelecimentos.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@
"data_type": "date",
},
cluster_by="sigla_uf",
incremental_strategy="insert_overwrite",
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(data), MONTH) > 6)',
'CREATE OR REPLACE ROW ACCESS POLICY bdpro_filter ON {{this}} GRANT TO ("group:[email protected]", "group:[email protected]") FILTER USING (DATE_DIFF(DATE("{{ run_started_at.strftime("%Y-%m-%d") }}"),DATE(data), MONTH) <= 6)',
],
)
}}
with
Expand Down Expand Up @@ -63,4 +60,4 @@ with
)
select *
from cnpj_estabelecimentos
{% if is_incremental() %} where data > '2024-09-01' {% endif %}
{% if is_incremental() %} where data in ('2024-09-18', '2024-10-16') {% endif %}
7 changes: 2 additions & 5 deletions models/br_me_cnpj/br_me_cnpj__socios.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
"data_type": "date",
},
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(data), MONTH) > 6)',
'CREATE OR REPLACE ROW ACCESS POLICY bdpro_filter ON {{this}} GRANT TO ("group:[email protected]", "group:[email protected]") FILTER USING (DATE_DIFF(DATE("{{ run_started_at.strftime("%Y-%m-%d") }}"),DATE(data), MONTH) <= 6)',
],
incremental_strategy="insert_overwrite",
)
}}
with
Expand All @@ -36,4 +33,4 @@ with
)
select *
from cnpj_socios
{% if is_incremental() %} where data > '2024-09-01' {% endif %}
{% if is_incremental() %} where data in ('2024-09-18', '2024-10-16') {% endif %}

0 comments on commit 37372da

Please sign in to comment.