Skip to content

Commit

Permalink
feat: udpate caged dbt models
Browse files Browse the repository at this point in the history
  • Loading branch information
folhesgabriel committed Nov 28, 2024
1 parent 625d86e commit 1e658a9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{{
config(
schema="br_me_caged",
materialized="table",
materialized="incremental",
alias="movimentacao",
partition_by={
"field": "ano",
"data_type": "int64",
Expand All @@ -12,6 +13,7 @@
pre_hook="DROP ALL ROW ACCESS POLICIES ON {{ this }}",
)
}}

select
safe_cast(ano as int64) ano,
safe_cast(mes as int64) mes,
Expand Down Expand Up @@ -50,3 +52,9 @@ from `basedosdados-staging.br_me_caged_staging.microdados_movimentacao` a
left join
`basedosdados.br_bd_diretorios_brasil.municipio` b
on a.id_municipio = b.id_municipio_6

{% if is_incremental() %}
where
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 %}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
config(
schema="br_me_caged",
materialized="table",
alias="movimentacao_excluida",
partition_by={
"field": "ano",
"data_type": "int64",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
config(
schema="br_me_caged",
materialized="table",
alias="movimentacao_fora_prazo",
partition_by={
"field": "ano",
"data_type": "int64",
Expand Down
2 changes: 1 addition & 1 deletion models/br_me_caged/schema.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
version: 2
models:
- name: microdados_movimentacao
- name: br_me_caged__microdados_movimentacao
description: Contém dados de movimentações declaradas dentro do prazo com competência
de declaração.
tests:
Expand Down

0 comments on commit 1e658a9

Please sign in to comment.