Skip to content

Commit

Permalink
fix: changing materialized mode
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurfg committed Nov 27, 2023
1 parent a4def01 commit 15dbd25
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 16 deletions.
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ models:
- 'REVOKE `roles/bigquery.dataViewer` ON TABLE {{ this }} FROM "specialGroup:allUsers"'
- 'GRANT `roles/bigquery.dataViewer` ON TABLE {{ this }} TO "group:[email protected]"'
br_cgu_beneficios_cidadao:
+materialized: incremental
+materialized: table
+schema: br_cgu_beneficios_cidadao
br_cgu_servidores_executivo_federal:
+materialized: table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
config(
alias='bpc',
schema='br_cgu_beneficios_cidadao',
materialized='incremental',
materialized='table',
partition_by={
"field": "ano_competencia",
"data_type": "int64",
Expand Down Expand Up @@ -44,7 +44,4 @@ SAFE_CAST(valor AS FLOAT64) valor_parcela,
FROM `basedosdados-staging.br_cgu_beneficios_cidadao_staging.bpc` t1
left join `basedosdados.br_bd_diretorios_brasil.municipio` t2
on SAFE_CAST(t1.id_municipio_siafi AS INT64) = SAFE_CAST(t2.id_municipio_rf AS INT64))
select * except(data) from bpc
{% if is_incremental() %}
WHERE data > (SELECT MAX(data) FROM {{ this }} )
{% endif %}
select * except(data) from bpc
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
config(
alias='garantia_safra',
schema='br_cgu_beneficios_cidadao',
materialized='incremental',
materialized='table',
partition_by={
"field": "ano_referencia",
"data_type": "int64",
"range": {
"start": 2013,
"end": 2024,
"interval": 1}
},
"interval": 1}},
cluster_by = ["mes_referencia", "sigla_uf"] ,
pre_hook = "DROP ALL ROW ACCESS POLICIES ON {{ this }}",
post_hook = [
Expand All @@ -37,6 +36,3 @@ FROM `basedosdados-staging.br_cgu_beneficios_cidadao_staging.garantia_safra` t1
left join `basedosdados.br_bd_diretorios_brasil.municipio` t2
on SAFE_CAST(t1.id_municipio_siafi AS INT64) = SAFE_CAST(t2.id_municipio_rf AS INT64))
select * except(data) from garantia_safra
{% if is_incremental() %}
WHERE data > (SELECT MAX(data) FROM {{ this }} )
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
config(
alias='novo_bolsa_familia',
schema='br_cgu_beneficios_cidadao',
materialized='incremental',
materialized='table',
partition_by={
"field": "ano_competencia",
"data_type": "int64",
Expand Down Expand Up @@ -40,6 +40,3 @@ FROM `basedosdados-staging.br_cgu_beneficios_cidadao_staging.novo_bolsa_familia`
left join `basedosdados.br_bd_diretorios_brasil.municipio` t2
on SAFE_CAST(t1.id_municipio_siafi AS INT64) = SAFE_CAST(t2.id_municipio_rf AS INT64))
select * except(data) from novo_bolsa_familia
{% if is_incremental() %}
WHERE data > (SELECT MAX(data) FROM {{ this }} )
{% endif %}

0 comments on commit 15dbd25

Please sign in to comment.