From 999113e77eb163f77e65f1ac0cad40182899435b Mon Sep 17 00:00:00 2001 From: folhesgabriel Date: Wed, 24 Apr 2024 15:26:01 -0300 Subject: [PATCH 1/3] update comex dictionary and prod data --- models/br_me_comex_stat/br_me_comex_stat__dicionario.sql | 8 +++++++- models/br_me_comex_stat/schema.yml | 6 +++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/models/br_me_comex_stat/br_me_comex_stat__dicionario.sql b/models/br_me_comex_stat/br_me_comex_stat__dicionario.sql index 22a4c2c7..d6103472 100644 --- a/models/br_me_comex_stat/br_me_comex_stat__dicionario.sql +++ b/models/br_me_comex_stat/br_me_comex_stat__dicionario.sql @@ -6,7 +6,13 @@ }} select safe_cast(id_tabela as string) id_tabela, - safe_cast(coluna as string) coluna, + safe_cast( + case + when coluna = 'id_urf' + then lpad(safe_cast(chave as string), 6, '0') + else safe_cast(chave as string) + end as string + ) nome_coluna, safe_cast(chave as string) chave, safe_cast(cobertura_temporal as string) cobertura_temporal, safe_cast(valor as string) valor diff --git a/models/br_me_comex_stat/schema.yml b/models/br_me_comex_stat/schema.yml index 305abd44..fad4ce4a 100644 --- a/models/br_me_comex_stat/schema.yml +++ b/models/br_me_comex_stat/schema.yml @@ -102,11 +102,11 @@ models: columns: - name: id_tabela description: ID da tabela - - name: coluna - description: Coluna + - name: nome_coluna + description: Nome da coluna - name: chave description: Chave - name: cobertura_temporal - description: Cobertura Temporal + description: Cobertura temporal - name: valor description: Valor From 6916901126b4e9db6382dc405945e8af91e71dbd Mon Sep 17 00:00:00 2001 From: folhesgabriel Date: Wed, 24 Apr 2024 17:01:08 -0300 Subject: [PATCH 2/3] minor fixes --- models/br_me_comex_stat/br_me_comex_stat__dicionario.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/models/br_me_comex_stat/br_me_comex_stat__dicionario.sql b/models/br_me_comex_stat/br_me_comex_stat__dicionario.sql index d6103472..b3f6ef09 100644 --- a/models/br_me_comex_stat/br_me_comex_stat__dicionario.sql +++ b/models/br_me_comex_stat/br_me_comex_stat__dicionario.sql @@ -6,14 +6,14 @@ }} select safe_cast(id_tabela as string) id_tabela, + safe_cast(coluna as string) nome_coluna, safe_cast( case when coluna = 'id_urf' then lpad(safe_cast(chave as string), 6, '0') else safe_cast(chave as string) end as string - ) nome_coluna, - safe_cast(chave as string) chave, + ) chave, safe_cast(cobertura_temporal as string) cobertura_temporal, safe_cast(valor as string) valor -from `basedosdados-staging.br_me_comex_stat_staging.dicionario` as t +from `basedosdados-dev.br_me_comex_stat_staging.dicionario` as t From 305154afded998d6a591f14a2ef3f0b06b2629b0 Mon Sep 17 00:00:00 2001 From: folhesgabriel Date: Wed, 24 Apr 2024 17:03:35 -0300 Subject: [PATCH 3/3] fix project name --- models/br_me_comex_stat/br_me_comex_stat__dicionario.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/br_me_comex_stat/br_me_comex_stat__dicionario.sql b/models/br_me_comex_stat/br_me_comex_stat__dicionario.sql index b3f6ef09..57ac30e8 100644 --- a/models/br_me_comex_stat/br_me_comex_stat__dicionario.sql +++ b/models/br_me_comex_stat/br_me_comex_stat__dicionario.sql @@ -16,4 +16,4 @@ select ) chave, safe_cast(cobertura_temporal as string) cobertura_temporal, safe_cast(valor as string) valor -from `basedosdados-dev.br_me_comex_stat_staging.dicionario` as t +from `basedosdados-staging.br_me_comex_stat_staging.dicionario` as t