-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #207 from basedosdados/staging/br_bd_diretorios_br…
…asil.cep [dbt] br_bd_diretorios_brasil.cep
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{{ | ||
config( | ||
schema='br_bd_diretorios_brasil', | ||
materialized='table', | ||
partition_by={ | ||
"field": "sigla_uf", | ||
"data_type": "string", | ||
} | ||
) | ||
}} | ||
|
||
SELECT | ||
SAFE_CAST(lpad(cep, 8, '0') AS STRING) cep, | ||
SAFE_CAST(logradouro AS STRING) logradouro, | ||
SAFE_CAST(complemento AS STRING) complemento, | ||
SAFE_CAST(bairro AS STRING) bairro, | ||
SAFE_CAST(cidade AS STRING) cidade, | ||
SAFE_CAST(id_municipio AS STRING) id_municipio, | ||
SAFE_CAST(sigla_uf AS STRING) sigla_uf, | ||
SAFE_CAST(latitude AS FLOAT64) latitude, | ||
SAFE_CAST(longitude AS FLOAT64) longitude, | ||
ST_GEOGPOINT(SAFE_CAST(longitude AS FLOAT64),SAFE_CAST(latitude AS FLOAT64)) centroide | ||
FROM basedosdados-dev.br_bd_diretorios_brasil_staging.cep AS t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters