-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
270d879
commit 63b39e3
Showing
34 changed files
with
17,349 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
models/br_ibge_censo_demografico/br_ibge_censo_demografico__dicionario.sql
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,14 @@ | ||
{{ | ||
config( | ||
alias = 'dicionario', | ||
schema='br_ibge_censo_demografico', | ||
materialized='table', | ||
) | ||
}} | ||
SELECT | ||
SAFE_CAST(id_tabela AS STRING) id_tabela, | ||
SAFE_CAST(nome_coluna AS STRING) nome_coluna, | ||
SAFE_CAST(chave AS STRING) chave, | ||
SAFE_CAST(cobertura_temporal AS STRING) cobertura_temporal, | ||
SAFE_CAST(valor AS STRING) valor | ||
FROM basedosdados-staging.br_ibge_censo_demografico_staging.dicionario AS t |
40 changes: 40 additions & 0 deletions
40
models/br_ibge_censo_demografico/br_ibge_censo_demografico__microdados_domicilio_1970.sql
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,40 @@ | ||
{{ | ||
config( | ||
alias='microdados_domicilio_1970', | ||
schema='br_ibge_censo_demografico', | ||
materialized='table', | ||
partition_by={ | ||
"field": "sigla_uf", | ||
"data_type": "string", | ||
}, | ||
) | ||
}} | ||
|
||
SELECT | ||
SAFE_CAST(sigla_uf AS STRING) sigla_uf, | ||
SAFE_CAST(id_municipio AS STRING) id_municipio, | ||
SAFE_CAST(id_domicilio AS STRING) id_domicilio, | ||
SAFE_CAST(numero_familia AS INT64) numero_familia, | ||
SAFE_CAST(v001 AS INT64) v001, | ||
SAFE_CAST(v002 AS INT64) v002, | ||
SAFE_CAST(v003 AS INT64) v003, | ||
SAFE_CAST(v004 AS INT64) v004, | ||
SAFE_CAST(v005 AS INT64) v005, | ||
SAFE_CAST(v006 AS INT64) v006, | ||
SAFE_CAST(v007 AS INT64) v007, | ||
SAFE_CAST(v008 AS INT64) v008, | ||
SAFE_CAST(v009 AS INT64) v009, | ||
SAFE_CAST(v010 AS INT64) v010, | ||
SAFE_CAST(v011 AS INT64) v011, | ||
SAFE_CAST(v012 AS INT64) v012, | ||
SAFE_CAST(v013 AS INT64) v013, | ||
SAFE_CAST(v014 AS INT64) v014, | ||
SAFE_CAST(v015 AS INT64) v015, | ||
SAFE_CAST(v016 AS INT64) v016, | ||
SAFE_CAST(v017 AS INT64) v017, | ||
SAFE_CAST(v018 AS INT64) v018, | ||
SAFE_CAST(v019 AS INT64) v019, | ||
SAFE_CAST(v020 AS INT64) v020, | ||
SAFE_CAST(v021 AS INT64) v021, | ||
SAFE_CAST(v054 AS INT64) v054 | ||
FROM basedosdados-staging.br_ibge_censo_demografico_staging.microdados_domicilio_1970 AS t |
39 changes: 39 additions & 0 deletions
39
models/br_ibge_censo_demografico/br_ibge_censo_demografico__microdados_domicilio_1980.sql
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,39 @@ | ||
{{ | ||
config( | ||
alias='microdados_domicilio_1980', | ||
schema='br_ibge_censo_demografico', | ||
materialized='table', | ||
partition_by={ | ||
"field": "sigla_uf", | ||
"data_type": "string", | ||
}, | ||
) | ||
}} | ||
SELECT | ||
SAFE_CAST(sigla_uf AS STRING) sigla_uf, | ||
SAFE_CAST(id_municipio AS STRING) id_municipio, | ||
SAFE_CAST(id_distrito AS STRING) id_distrito, | ||
SAFE_CAST(v201 AS INT64) v201, | ||
SAFE_CAST(v202 AS INT64) v202, | ||
SAFE_CAST(v203 AS INT64) v203, | ||
SAFE_CAST(v204 AS INT64) v204, | ||
SAFE_CAST(v205 AS INT64) v205, | ||
SAFE_CAST(v206 AS INT64) v206, | ||
SAFE_CAST(v207 AS INT64) v207, | ||
SAFE_CAST(v208 AS INT64) v208, | ||
SAFE_CAST(v209 AS INT64) v209, | ||
SAFE_CAST(v602 AS INT64) v602, | ||
SAFE_CAST(v212 AS INT64) v212, | ||
SAFE_CAST(v213 AS INT64) v213, | ||
SAFE_CAST(v214 AS INT64) v214, | ||
SAFE_CAST(v215 AS INT64) v215, | ||
SAFE_CAST(v216 AS INT64) v216, | ||
SAFE_CAST(v217 AS INT64) v217, | ||
SAFE_CAST(v218 AS INT64) v218, | ||
SAFE_CAST(v219 AS INT64) v219, | ||
SAFE_CAST(v220 AS INT64) v220, | ||
SAFE_CAST(v221 AS INT64) v221, | ||
SAFE_CAST(v198 AS INT64) v198, | ||
SAFE_CAST(v603 AS INT64) v603, | ||
SAFE_CAST(v598 AS INT64) v598 | ||
from basedosdados-staging.br_ibge_censo_demografico_staging.microdados_domicilio_1980 as t |
56 changes: 56 additions & 0 deletions
56
models/br_ibge_censo_demografico/br_ibge_censo_demografico__microdados_domicilio_1991.sql
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,56 @@ | ||
{{ | ||
config( | ||
alias='microdados_domicilio_1991', | ||
schema='br_ibge_censo_demografico', | ||
materialized='table', | ||
partition_by={ | ||
"field": "sigla_uf", | ||
"data_type": "string", | ||
}, | ||
) | ||
}} | ||
SELECT | ||
SAFE_CAST(sigla_uf AS STRING) sigla_uf, | ||
SAFE_CAST(id_municipio AS STRING) id_municipio, | ||
SAFE_CAST(id_questionario AS STRING) id_questionario, | ||
SAFE_CAST(peso_amostral AS FLOAT64) peso_amostral, | ||
SAFE_CAST(v0109 AS INT64) v0109, | ||
SAFE_CAST(v1061 AS INT64) v1061, | ||
SAFE_CAST(v7003 AS INT64) v7003, | ||
SAFE_CAST(v0111 AS INT64) v0111, | ||
SAFE_CAST(v0112 AS INT64) v0112, | ||
SAFE_CAST(v0201 AS INT64) v0201, | ||
SAFE_CAST(v2012 AS INT64) v2012, | ||
SAFE_CAST(v2013 AS INT64) v2013, | ||
SAFE_CAST(v2014 AS INT64) v2014, | ||
SAFE_CAST(v0202 AS INT64) v0202, | ||
SAFE_CAST(v0203 AS INT64) v0203, | ||
SAFE_CAST(v0204 AS INT64) v0204, | ||
SAFE_CAST(v0205 AS INT64) v0205, | ||
SAFE_CAST(v0206 AS INT64) v0206, | ||
SAFE_CAST(v0207 AS INT64) v0207, | ||
SAFE_CAST(v0208 AS INT64) v0208, | ||
SAFE_CAST(v0209 AS INT64) v0209, | ||
SAFE_CAST(v2094 AS INT64) v2094, | ||
SAFE_CAST(v0210 AS INT64) v0210, | ||
SAFE_CAST(v0211 AS INT64) v0211, | ||
SAFE_CAST(v2111 AS INT64) v2111, | ||
SAFE_CAST(v2112 AS INT64) v2112, | ||
SAFE_CAST(v0212 AS INT64) v0212, | ||
SAFE_CAST(v2121 AS INT64) v2121, | ||
SAFE_CAST(v2122 AS INT64) v2122, | ||
SAFE_CAST(v0213 AS INT64) v0213, | ||
SAFE_CAST(v0214 AS INT64) v0214, | ||
SAFE_CAST(v0216 AS INT64) v0216, | ||
SAFE_CAST(v0217 AS INT64) v0217, | ||
SAFE_CAST(v0218 AS INT64) v0218, | ||
SAFE_CAST(v0219 AS INT64) v0219, | ||
SAFE_CAST(v0220 AS INT64) v0220, | ||
SAFE_CAST(v0221 AS INT64) v0221, | ||
SAFE_CAST(v0222 AS INT64) v0222, | ||
SAFE_CAST(v0223 AS INT64) v0223, | ||
SAFE_CAST(v0224 AS INT64) v0224, | ||
SAFE_CAST(v0225 AS INT64) v0225, | ||
SAFE_CAST(v0226 AS INT64) v0226, | ||
SAFE_CAST(v0227 AS INT64) v0227 | ||
from basedosdados-staging.br_ibge_censo_demografico_staging.microdados_domicilio_1991 as t |
69 changes: 69 additions & 0 deletions
69
models/br_ibge_censo_demografico/br_ibge_censo_demografico__microdados_domicilio_2000.sql
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,69 @@ | ||
{{ | ||
config( | ||
alias='microdados_domicilio_2000', | ||
schema='br_ibge_censo_demografico', | ||
materialized='table', | ||
partition_by={ | ||
"field": "sigla_uf", | ||
"data_type": "string", | ||
}, | ||
) | ||
}} | ||
SELECT | ||
SAFE_CAST(id_regiao AS STRING) id_regiao, | ||
SAFE_CAST(sigla_uf AS STRING) sigla_uf, | ||
SAFE_CAST(id_mesorregiao AS STRING) id_mesorregiao, | ||
SAFE_CAST(id_microrregiao AS STRING) id_microrregiao, | ||
SAFE_CAST(id_regiao_metropolitana AS STRING) id_regiao_metropolitana, | ||
SAFE_CAST(id_municipio AS STRING) id_municipio, | ||
SAFE_CAST(id_distrito AS STRING) id_distrito, | ||
SAFE_CAST(id_subdistrito AS STRING) id_subdistrito, | ||
SAFE_CAST(controle AS INT64) controle, | ||
SAFE_CAST(situacao_setor AS INT64) situacao_setor, | ||
SAFE_CAST(situacao_domicilio AS INT64) situacao_domicilio, | ||
SAFE_CAST(tipo_setor AS STRING) tipo_setor, | ||
SAFE_CAST(peso_amostral AS FLOAT64) peso_amostral, | ||
SAFE_CAST(area_ponderacao AS INT64) area_ponderacao, | ||
SAFE_CAST(v0110 AS INT64) v0110, | ||
SAFE_CAST(v0111 AS INT64) v0111, | ||
SAFE_CAST(v0201 AS INT64) v0201, | ||
SAFE_CAST(v0202 AS INT64) v0202, | ||
SAFE_CAST(v0203 AS INT64) v0203, | ||
SAFE_CAST(v0204 AS INT64) v0204, | ||
SAFE_CAST(v0205 AS INT64) v0205, | ||
SAFE_CAST(v0206 AS INT64) v0206, | ||
SAFE_CAST(v0207 AS INT64) v0207, | ||
SAFE_CAST(v0208 AS INT64) v0208, | ||
SAFE_CAST(v0209 AS INT64) v0209, | ||
SAFE_CAST(v0210 AS INT64) v0210, | ||
SAFE_CAST(v0211 AS INT64) v0211, | ||
SAFE_CAST(v0212 AS INT64) v0212, | ||
SAFE_CAST(v0213 AS INT64) v0213, | ||
SAFE_CAST(v0214 AS INT64) v0214, | ||
SAFE_CAST(v0215 AS INT64) v0215, | ||
SAFE_CAST(v0216 AS INT64) v0216, | ||
SAFE_CAST(v0217 AS INT64) v0217, | ||
SAFE_CAST(v0218 AS INT64) v0218, | ||
SAFE_CAST(v0219 AS INT64) v0219, | ||
SAFE_CAST(v0220 AS INT64) v0220, | ||
SAFE_CAST(v0221 AS INT64) v0221, | ||
SAFE_CAST(v0222 AS INT64) v0222, | ||
SAFE_CAST(v0223 AS INT64) v0223, | ||
SAFE_CAST(v7100 AS INT64) v7100, | ||
SAFE_CAST(v7203 AS FLOAT64) v7203, | ||
SAFE_CAST(v7204 AS FLOAT64) v7204, | ||
SAFE_CAST(v7401 AS INT64) v7401, | ||
SAFE_CAST(v7402 AS INT64) v7402, | ||
SAFE_CAST(v7403 AS INT64) v7403, | ||
SAFE_CAST(v7404 AS INT64) v7404, | ||
SAFE_CAST(v7405 AS INT64) v7405, | ||
SAFE_CAST(v7406 AS INT64) v7406, | ||
SAFE_CAST(v7407 AS INT64) v7407, | ||
SAFE_CAST(v7408 AS INT64) v7408, | ||
SAFE_CAST(v7409 AS INT64) v7409, | ||
SAFE_CAST(v7616 AS INT64) v7616, | ||
SAFE_CAST(v7617 AS INT64) v7617, | ||
SAFE_CAST(v1111 AS INT64) v1111, | ||
SAFE_CAST(v1112 AS INT64) v1112, | ||
SAFE_CAST(v1113 AS INT64) v1113 | ||
from basedosdados-staging.br_ibge_censo_demografico_staging.microdados_domicilio_2000 as t |
89 changes: 89 additions & 0 deletions
89
models/br_ibge_censo_demografico/br_ibge_censo_demografico__microdados_domicilio_2010.sql
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,89 @@ | ||
{{ | ||
config( | ||
alias='microdados_domicilio_2010', | ||
schema='br_ibge_censo_demografico', | ||
materialized='table', | ||
partition_by={ | ||
"field": "sigla_uf", | ||
"data_type": "string", | ||
}, | ||
) | ||
}} | ||
SELECT | ||
SAFE_CAST(id_regiao AS STRING) id_regiao, | ||
SAFE_CAST(sigla_uf AS STRING) sigla_uf, | ||
SAFE_CAST(id_mesorregiao AS STRING) id_mesorregiao, | ||
SAFE_CAST(id_microrregiao AS STRING) id_microrregiao, | ||
SAFE_CAST(id_regiao_metropolitana AS STRING) id_regiao_metropolitana, | ||
SAFE_CAST(id_municipio AS STRING) id_municipio, | ||
SAFE_CAST(situacao_setor AS INT64) situacao_setor, | ||
SAFE_CAST(situacao_domicilio AS INT64) situacao_domicilio, | ||
SAFE_CAST(controle AS INT64) controle, | ||
SAFE_CAST(peso_amostral AS FLOAT64) peso_amostral, | ||
SAFE_CAST(area_ponderacao AS INT64) area_ponderacao, | ||
SAFE_CAST(v4001 AS INT64) v4001, | ||
SAFE_CAST(v4002 AS INT64) v4002, | ||
SAFE_CAST(v0201 AS INT64) v0201, | ||
SAFE_CAST(v2011 AS INT64) v2011, | ||
SAFE_CAST(v2012 AS FLOAT64) v2012, | ||
SAFE_CAST(v0202 AS INT64) v0202, | ||
SAFE_CAST(v0203 AS INT64) v0203, | ||
SAFE_CAST(v6203 AS FLOAT64) v6203, | ||
SAFE_CAST(v0204 AS INT64) v0204, | ||
SAFE_CAST(v6204 AS FLOAT64) v6204, | ||
SAFE_CAST(v0205 AS INT64) v0205, | ||
SAFE_CAST(v0206 AS INT64) v0206, | ||
SAFE_CAST(v0207 AS INT64) v0207, | ||
SAFE_CAST(v0208 AS INT64) v0208, | ||
SAFE_CAST(v0209 AS INT64) v0209, | ||
SAFE_CAST(v0210 AS INT64) v0210, | ||
SAFE_CAST(v0211 AS INT64) v0211, | ||
SAFE_CAST(v0212 AS INT64) v0212, | ||
SAFE_CAST(v0213 AS INT64) v0213, | ||
SAFE_CAST(v0214 AS INT64) v0214, | ||
SAFE_CAST(v0215 AS INT64) v0215, | ||
SAFE_CAST(v0216 AS INT64) v0216, | ||
SAFE_CAST(v0217 AS INT64) v0217, | ||
SAFE_CAST(v0218 AS INT64) v0218, | ||
SAFE_CAST(v0219 AS INT64) v0219, | ||
SAFE_CAST(v0220 AS INT64) v0220, | ||
SAFE_CAST(v0221 AS INT64) v0221, | ||
SAFE_CAST(v0222 AS INT64) v0222, | ||
SAFE_CAST(v0301 AS INT64) v0301, | ||
SAFE_CAST(v0401 AS INT64) v0401, | ||
SAFE_CAST(v0402 AS INT64) v0402, | ||
SAFE_CAST(v0701 AS INT64) v0701, | ||
SAFE_CAST(v6529 AS INT64) v6529, | ||
SAFE_CAST(v6530 AS FLOAT64) v6530, | ||
SAFE_CAST(v6531 AS INT64) v6531, | ||
SAFE_CAST(v6532 AS FLOAT64) v6532, | ||
SAFE_CAST(v6600 AS INT64) v6600, | ||
SAFE_CAST(v6210 AS INT64) v6210, | ||
SAFE_CAST(m0201 AS STRING) m0201, | ||
SAFE_CAST(m02011 AS STRING) m02011, | ||
SAFE_CAST(m0202 AS STRING) m0202, | ||
SAFE_CAST(m0203 AS STRING) m0203, | ||
SAFE_CAST(m0204 AS STRING) m0204, | ||
SAFE_CAST(m0205 AS STRING) m0205, | ||
SAFE_CAST(m0206 AS STRING) m0206, | ||
SAFE_CAST(m0207 AS STRING) m0207, | ||
SAFE_CAST(m0208 AS STRING) m0208, | ||
SAFE_CAST(m0209 AS STRING) m0209, | ||
SAFE_CAST(m0210 AS STRING) m0210, | ||
SAFE_CAST(m0211 AS STRING) m0211, | ||
SAFE_CAST(m0212 AS STRING) m0212, | ||
SAFE_CAST(m0213 AS STRING) m0213, | ||
SAFE_CAST(m0214 AS STRING) m0214, | ||
SAFE_CAST(m0215 AS STRING) m0215, | ||
SAFE_CAST(m0216 AS STRING) m0216, | ||
SAFE_CAST(m0217 AS STRING) m0217, | ||
SAFE_CAST(m0218 AS STRING) m0218, | ||
SAFE_CAST(m0219 AS STRING) m0219, | ||
SAFE_CAST(m0220 AS STRING) m0220, | ||
SAFE_CAST(m0221 AS STRING) m0221, | ||
SAFE_CAST(m0222 AS STRING) m0222, | ||
SAFE_CAST(m0301 AS STRING) m0301, | ||
SAFE_CAST(m0401 AS STRING) m0401, | ||
SAFE_CAST(m0402 AS STRING) m0402, | ||
SAFE_CAST(m0701 AS STRING) m0701 | ||
from basedosdados-staging.br_ibge_censo_demografico_staging.microdados_domicilio_2010 as t |
54 changes: 54 additions & 0 deletions
54
models/br_ibge_censo_demografico/br_ibge_censo_demografico__microdados_pessoa_1970.sql
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,54 @@ | ||
{{ | ||
config( | ||
alias='microdados_pessoa_1970', | ||
schema='br_ibge_censo_demografico', | ||
materialized='table', | ||
partition_by={ | ||
"field": "sigla_uf", | ||
"data_type": "string", | ||
}, | ||
) | ||
}} | ||
SELECT | ||
SAFE_CAST(sigla_uf AS STRING) sigla_uf, | ||
SAFE_CAST(id_municipio AS STRING) id_municipio, | ||
SAFE_CAST(id_domicilio AS STRING) id_domicilio, | ||
SAFE_CAST(numero_familia AS INT64) numero_familia, | ||
SAFE_CAST(ordem AS INT64) ordem, | ||
SAFE_CAST(v001 AS INT64) v001, | ||
SAFE_CAST(v002 AS INT64) v002, | ||
SAFE_CAST(v003 AS INT64) v003, | ||
SAFE_CAST(v022 AS INT64) v022, | ||
SAFE_CAST(v023 AS INT64) v023, | ||
SAFE_CAST(v024 AS INT64) v024, | ||
SAFE_CAST(v025 AS INT64) v025, | ||
SAFE_CAST(v026 AS INT64) v026, | ||
SAFE_CAST(v027 AS INT64) v027, | ||
SAFE_CAST(v028 AS INT64) v028, | ||
SAFE_CAST(v029 AS INT64) v029, | ||
SAFE_CAST(v030 AS INT64) v030, | ||
SAFE_CAST(v031 AS INT64) v031, | ||
SAFE_CAST(v032 AS INT64) v032, | ||
SAFE_CAST(v033 AS INT64) v033, | ||
SAFE_CAST(v034 AS INT64) v034, | ||
SAFE_CAST(v035 AS INT64) v035, | ||
SAFE_CAST(v036 AS INT64) v036, | ||
SAFE_CAST(v037 AS INT64) v037, | ||
SAFE_CAST(v038 AS INT64) v038, | ||
SAFE_CAST(v039 AS INT64) v039, | ||
SAFE_CAST(v040 AS INT64) v040, | ||
SAFE_CAST(v041 AS INT64) v041, | ||
SAFE_CAST(v042 AS INT64) v042, | ||
SAFE_CAST(v043 AS INT64) v043, | ||
SAFE_CAST(v044 AS INT64) v044, | ||
SAFE_CAST(v045 AS INT64) v045, | ||
SAFE_CAST(v046 AS INT64) v046, | ||
SAFE_CAST(v047 AS INT64) v047, | ||
SAFE_CAST(v048 AS INT64) v048, | ||
SAFE_CAST(v049 AS INT64) v049, | ||
SAFE_CAST(v050 AS INT64) v050, | ||
SAFE_CAST(v051 AS INT64) v051, | ||
SAFE_CAST(v052 AS INT64) v052, | ||
SAFE_CAST(v053 AS INT64) v053, | ||
SAFE_CAST(v054 AS INT64) v054 | ||
FROM basedosdados-staging.br_ibge_censo_demografico_staging.microdados_pessoa_1970 AS t |
Oops, something went wrong.