Skip to content

Commit

Permalink
feat: add coordenada-endereco query and schema
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurfg committed Feb 6, 2024
1 parent 883b743 commit a9b1390
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{
config(alias='coordenada_endereco',
schema='br_ibge_censo_2022',
materialized='table',
partition_by={
"field": "id_uf",
"data_type": "int64",
},
cluster_by = ["id_municipio"])}}

SELECT
SAFE_CAST(id_uf AS STRING) id_uf,
SAFE_CAST(COD_MUN AS STRING) id_municipio,
SAFE_CAST(COD_ESPECIE AS STRING) especie_endereco,
SAFE_CAST(NV_GEO_COORD AS STRING) nivel_geo_coordenada,
SAFE_CAST(LATITUDE AS FLOAT64) latitude,
SAFE_CAST(LONGITUDE AS FLOAT64) longitude,
ST_GEOGPOINT(SAFE_CAST(LONGITUDE AS FLOAT64),SAFE_CAST(LATITUDE AS FLOAT64)) ponto
FROM basedosdados-staging.br_ibge_censo_2022_staging.coordenada_endereco AS t



52 changes: 52 additions & 0 deletions models/br_ibge_censo_2022/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -780,3 +780,55 @@ models:
tests:
- dbt_utils.not_null_proportion:
at_least: 0.05
- name: br_ibge_censo_2022__coordenada_endereco
description: Coordenadas geográficas das espécies de endereços do Censo 2022
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- id_municipio
- id_uf
- latitude
- longitude
- nivel_geo_coordenada
columns:
- name: id_municipio
description: ID Município IBGE - 7 Dígitos
tests:
- dbt_utils.not_null_proportion:
at_least: 0.05
- relationships:
to: ref('br_bd_diretorios_brasil__municipio')
field: id_municipio
- name: id_uf
description: ID da Unidade da Federação
tests:
- dbt_utils.not_null_proportion:
at_least: 0.05
- relationships:
to: ref('br_bd_diretorios_brasil__uf')
field: id
- name: especie_endereco
description: Espécie de endereço
tests:
- dbt_utils.not_null_proportion:
at_least: 0.05
- name: nivel_geo_coordenada
description: Nível de geocodificação
tests:
- dbt_utils.not_null_proportion:
at_least: 0.05
- name: latitude
description: Latitude da Coordenada de Localização da Espécie do Endereço
tests:
- dbt_utils.not_null_proportion:
at_least: 0.05
- name: longitude
description: Longitude da Coordenada de Localização da Espécie do Endereço
tests:
- dbt_utils.not_null_proportion:
at_least: 0.05
- name: ponto
description: Ponto geográfico criado a partir das colunas longitude e latitude.
tests:
- dbt_utils.not_null_proportion:
at_least: 0.05

0 comments on commit a9b1390

Please sign in to comment.