-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adiciona versão final do modelo e schema
- Loading branch information
1 parent
358533a
commit 1d3469b
Showing
2 changed files
with
6 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,22 +2,23 @@ | |
config( | ||
schema='br_rf_cafir', | ||
alias='imoveis_rurais', | ||
materialized='table', | ||
materialized='incremental', | ||
partition_by={ | ||
"field": "data_referencia", | ||
"data_type": "date", | ||
"granularity": "day" | ||
}, | ||
cluster_by=['sigla_uf'], | ||
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(data_referencia), MONTH) > 6', | ||
FILTER USING (DATE_DIFF(CURRENT_DATE(),DATE(data_referencia), MONTH) > 6)', | ||
'CREATE OR REPLACE ROW ACCESS POLICY bdpro_filter | ||
ON {{this}} | ||
GRANT TO ("group:[email protected]", "group:[email protected]") | ||
FILTER USING (EXTRACT(YEAR from data_referencia) = EXTRACT(YEAR from CURRENT_DATE()))'] | ||
) | ||
FILTER USING (EXTRACT(YEAR from data_referencia) = EXTRACT(YEAR from CURRENT_DATE()))' ] | ||
) | ||
}} | ||
|
||
with lower_munis as ( | ||
|
@@ -92,7 +93,7 @@ SELECT | |
SAFE_CAST(id_municipio as STRING) id_municipio, | ||
SAFE_CAST(sigla_uf as STRING) sigla_uf, | ||
--- esta coluna não é identifica no dicionário nem nomeada nos arquivos | ||
SAFE_CAST(LOWER(status_rever) as STRING) coluna_nao_identificada, | ||
--- SAFE_CAST(LOWER(status_rever) as STRING) coluna_nao_identificada, | ||
FROM fixed_names AS t | ||
{% if is_incremental() %} | ||
WHERE data_referencia > (SELECT MAX(data_referencia) FROM {{ this }} ) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters