Skip to content

Commit

Permalink
adiciona versão final do modelo e schema
Browse files Browse the repository at this point in the history
  • Loading branch information
folhesgabriel committed Sep 13, 2023
1 parent 358533a commit 1d3469b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
11 changes: 6 additions & 5 deletions models/br_rf_cafir/br_rf_cafir__imoveis_rurais.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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 }} )
Expand Down
3 changes: 0 additions & 3 deletions models/br_rf_cafir/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ models:
description: ID Município - IBGE 7 Dígitos
- name: sigla_uf
description: Sigla da Unidade da Federação (UF)
- name: coluna_nao_identificada
description: Esta coluna não é identifica no dicionário nem nomeada nos arquivos

- name: br_rf_cafir__dicionario
description: Dicionário de dados da tabela Imóveis Rurais
columns:
Expand Down

0 comments on commit 1d3469b

Please sign in to comment.