Skip to content

Commit

Permalink
Merge pull request #640 from basedosdados/staging/fix_comex_stat
Browse files Browse the repository at this point in the history
[fix] br_me_comex_stat
  • Loading branch information
folhesgabriel authored Jun 13, 2024
2 parents 03480e1 + 2b9c7da commit 14e87fa
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 11 deletions.
8 changes: 1 addition & 7 deletions models/br_me_comex_stat/br_me_comex_stat__dicionario.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@
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
) chave,
safe_cast(chave as string) 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
46 changes: 42 additions & 4 deletions models/br_me_comex_stat/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ models:
- sigla_uf
- id_municipio
- not_null_proportion_multiple_columns:
at_least: 0.95
at_least: 0.05
config:
where: __most_recent_year_month__
columns:
- name: ano
description: Ano
Expand All @@ -26,6 +28,8 @@ models:
- relationships:
to: ref('br_bd_diretorios_mundo__sistema_harmonizado')
field: id_sh4
config:
where: __most_recent_year_month__
- name: id_pais
description: ID do País
- name: sigla_pais_iso3
Expand All @@ -34,6 +38,8 @@ models:
- relationships:
to: ref('br_bd_diretorios_mundo__municipio')
field: sigla_pais_iso3
config:
where: __most_recent_year_month__
- name: sigla_uf
description: Sigla da Unidade da Federação
- name: id_municipio
Expand All @@ -42,6 +48,8 @@ models:
- relationships:
to: ref('br_bd_diretorios_brasil__municipio')
field: id_municipio
config:
where: __most_recent_year_month__
- name: peso_liquido_kg
description: Peso Líquido
- name: valor_fob_dolar
Expand All @@ -58,8 +66,12 @@ models:
- id_pais
- sigla_uf
- id_municipio
config:
where: __most_recent_year_month__
- not_null_proportion_multiple_columns:
at_least: 0.95
at_least: 0.05
config:
where: __most_recent_year_month__
columns:
- name: ano
description: Ano
Expand All @@ -71,6 +83,8 @@ models:
- relationships:
to: ref('br_bd_diretorios_mundo__sistema_harmonizado')
field: id_sh4
config:
where: __most_recent_year_month__
- name: id_pais
description: ID do País
- name: sigla_pais_iso3
Expand All @@ -79,6 +93,8 @@ models:
- relationships:
to: ref('br_bd_diretorios_mundo__municipio')
field: sigla_pais_iso3
config:
where: __most_recent_year_month__
- name: sigla_uf
description: Sigla da Unidade da Federação
- name: id_municipio
Expand All @@ -87,6 +103,8 @@ models:
- relationships:
to: ref('br_bd_diretorios_brasil__municipio')
field: id_municipio
config:
where: __most_recent_year_month__
- name: peso_liquido_kg
description: Peso Líquido
- name: valor_fob_dolar
Expand All @@ -104,8 +122,12 @@ models:
- id_pais
- id_via
- id_urf
config:
where: __most_recent_year_month__
- not_null_proportion_multiple_columns:
at_least: 0.95
at_least: 0.05
config:
where: __most_recent_year_month__
columns:
- name: ano
description: Ano
Expand All @@ -117,12 +139,16 @@ models:
- relationships:
to: ref('br_bd_diretorios_mundo__nomenclatura_comum_mercosul')
field: id_ncm
config:
where: __most_recent_year_month__
- name: id_unidade
description: ID Unidade
tests:
- relationships:
to: ref('br_bd_diretorios_mundo__nomenclatura_comum_mercosul')
field: id_unidade
config:
where: __most_recent_year_month__
- name: id_pais
description: ID do País
- name: sigla_pais_iso3
Expand All @@ -131,6 +157,8 @@ models:
- relationships:
to: ref('br_bd_diretorios_mundo__municipio')
field: sigla_pais_iso3
config:
where: __most_recent_year_month__
- name: sigla_uf_ncm
description: Sigla da Unidade da Federação - Nomenclatura Comum do Mercosul
- name: id_via
Expand Down Expand Up @@ -159,8 +187,12 @@ models:
- id_pais
- id_via
- id_urf
config:
where: __most_recent_year_month__
- not_null_proportion_multiple_columns:
at_least: 0.95
at_least: 0.05
config:
where: __most_recent_year_month__
columns:
- name: ano
description: Ano
Expand All @@ -172,12 +204,16 @@ models:
- relationships:
to: ref('br_bd_diretorios_mundo__nomenclatura_comum_mercosul')
field: id_ncm
config:
where: __most_recent_year_month__
- name: id_unidade
description: ID Unidade
tests:
- relationships:
to: ref('br_bd_diretorios_mundo__nomenclatura_comum_mercosul')
field: id_unidade
config:
where: __most_recent_year_month__
- name: id_pais
description: ID do País
- name: sigla_pais_iso3
Expand All @@ -186,6 +222,8 @@ models:
- relationships:
to: ref('br_bd_diretorios_mundo__municipio')
field: sigla_pais_iso3
config:
where: __most_recent_year_month__
- name: sigla_uf_ncm
description: Sigla da Unidade da Federação - Nomenclatura Comum do Mercosu
- name: id_via
Expand Down

0 comments on commit 14e87fa

Please sign in to comment.