Skip to content

Commit

Permalink
Merge pull request #797 from basedosdados/update-rais-2023
Browse files Browse the repository at this point in the history
[dbt] br_me_rais
  • Loading branch information
tricktx authored Oct 23, 2024
2 parents 6a0d5e9 + 53ad6fc commit 77b4dd6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 0 additions & 1 deletion models/br_me_rais/br_me_rais__dicionario.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{{ config(alias="dicionario", schema="br_me_rais") }}

select
safe_cast(id_tabela as string) id_tabela,
safe_cast(nome_coluna as string) nome_coluna,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
config(
alias="microdados_estabelecimentos",
schema="br_me_rais",
materialized="table",
materialized="incremental",
partition_by={
"field": "ano",
"data_type": "int64",
Expand Down Expand Up @@ -54,3 +54,7 @@ select
safe_cast(regexp_replace(regioes_administrativas_df, r'^0+', '') as string)
) as regioes_administrativas_df
from `basedosdados-staging.br_me_rais_staging.microdados_estabelecimentos` as t
{% if is_incremental() %}
where
safe_cast(ano as int64) > (select safe_cast(max(ano) as int64) from {{ this }})
{% endif %}
6 changes: 5 additions & 1 deletion models/br_me_rais/br_me_rais__microdados_vinculos.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
config(
alias="microdados_vinculos",
schema="br_me_rais",
materialized="table",
materialized="incremental",
partition_by={
"field": "ano",
"data_type": "int64",
Expand Down Expand Up @@ -102,3 +102,7 @@ select
safe_cast(regexp_replace(regioes_administrativas_df, r'^0+', '') as string)
) as regioes_administrativas_df
from `basedosdados-staging.br_me_rais_staging.microdados_vinculos`
{% if is_incremental() %}
where
safe_cast(ano as int64) > (select safe_cast(max(ano) as int64) from {{ this }})
{% endif %}

0 comments on commit 77b4dd6

Please sign in to comment.