Skip to content

Commit

Permalink
Merge pull request #179 from basedosdados/update_diretorios
Browse files Browse the repository at this point in the history
Atualiza diretórios brasileiros.
  • Loading branch information
rdahis authored Nov 21, 2020
2 parents 5dd8538 + fb00061 commit 8e72964
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 52 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Como capturar os dados de br_basedosdados_diretorios_brasil?
Como capturar os dados de br_bd_diretorios_brasil?

Para capturar esses dados basta entrar em X e fazer Y.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dataset_id: br_basedosdados_diretorios_brasil # AUTO GENERATED
dataset_id: br_bd_diretorios_brasil # AUTO GENERATED

url_ckan: https://basedosdados.org/dataset/br-basedosdados-diretorios-brasil
url_github: https://github.com/basedosdados/mais/tree/master/bases/br_basedosdados_diretorios_brasil
url_ckan: https://basedosdados.org/dataset/br-bd-diretorios-brasil
url_github: https://github.com/basedosdados/mais/tree/master/bases/br_bd_diretorios_brasil

# Descreva a base.
# Ela é sobre o que?
Expand All @@ -27,7 +27,7 @@ website:
# Quais grupos caracterizam a base?
# Opções: escolher dessa lista -> https://basedosdados.org/api/3/action/group_list
groups:
- organizacao-territorial
- territorio

# Quais etiquetas caracterizam a base?
# Opções: escolher dessa lista -> https://basedosdados.org/api/3/action/tag_list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ TIPOS:
- Mais detalhes: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types
*/
CREATE VIEW basedosdados.br_basedosdados_diretorios_brasil.municipios AS

CREATE VIEW basedosdados.br_bd_diretorios_brasil.municipio AS
SELECT
SAFE_CAST(id_municipio AS INT64) id_municipio,
SAFE_CAST(id_municipio_6 AS INT64) id_municipio_6,
SAFE_CAST(id_municipio_TSE AS INT64) id_municipio_TSE,
SAFE_CAST(id_municipio_RF AS INT64) id_municipio_RF,
SAFE_CAST(id_municipio_BCB AS INT64) id_municipio_BCB,
SAFE_CAST(id_municipio_tse AS INT64) id_municipio_tse,
SAFE_CAST(id_municipio_rf AS INT64) id_municipio_rf,
SAFE_CAST(id_municipio_bcb AS INT64) id_municipio_bcb,
SAFE_CAST(municipio AS STRING) municipio,
SAFE_CAST(capital_estado AS INT64) capital_estado,
SAFE_CAST(capital_uf AS INT64) capital_uf,
SAFE_CAST(id_comarca AS INT64) id_comarca,
SAFE_CAST(id_regiao_saude AS INT64) id_regiao_saude,
SAFE_CAST(regiao_saude AS STRING) regiao_saude,
Expand All @@ -38,11 +39,11 @@ SAFE_CAST(id_microrregiao AS INT64) id_microrregiao,
SAFE_CAST(microrregiao AS STRING) microrregiao,
SAFE_CAST(id_mesorregiao AS INT64) id_mesorregiao,
SAFE_CAST(mesorregiao AS STRING) mesorregiao,
SAFE_CAST(id_estado AS INT64) id_estado,
SAFE_CAST(estado_abrev AS STRING) estado_abrev,
SAFE_CAST(estado AS STRING) estado,
SAFE_CAST(id_uf AS INT64) id_uf,
SAFE_CAST(sigla_uf AS STRING) sigla_uf,
SAFE_CAST(uf AS STRING) uf,
SAFE_CAST(regiao AS STRING) regiao,
SAFE_CAST(existia_1991 AS INT64) existia_1991,
SAFE_CAST(existia_2000 AS INT64) existia_2000,
SAFE_CAST(existia_2010 AS INT64) existia_2010
from basedosdados-staging.br_basedosdados_diretorios_brasil_staging.municipios as t
from basedosdados-staging.br_bd_diretorios_brasil_staging.municipio as t
1 change: 1 addition & 0 deletions bases/br_bd_diretorios_brasil/municipio/schema-prod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"name": "id_municipio", "description": "ID Munic\u00edpio - IBGE 7 D\u00edgitos", "is_in_staging": true, "is_partition": false, "type": "INTEGER", "mode": "NULLABLE"}, {"name": "id_municipio_6", "description": "ID Munic\u00edpio - IBGE 6 D\u00edgitos", "is_in_staging": true, "is_partition": false, "type": "INTEGER", "mode": "NULLABLE"}, {"name": "id_municipio_tse", "description": "ID Munic\u00edpio - TSE", "is_in_staging": true, "is_partition": false, "type": "INTEGER", "mode": "NULLABLE"}, {"name": "id_municipio_rf", "description": "ID Munic\u00edpio - Receita Federal", "is_in_staging": true, "is_partition": false, "type": "INTEGER", "mode": "NULLABLE"}, {"name": "id_municipio_bcb", "description": "ID Munic\u00edpio - Banco Central do Brasil", "is_in_staging": true, "is_partition": false, "type": "INTEGER", "mode": "NULLABLE"}, {"name": "municipio", "description": "Nome Munic\u00edpio", "is_in_staging": true, "is_partition": false, "type": "STRING", "mode": "NULLABLE"}, {"name": "capital_uf", "description": "Capital da Unidade da Federa\u00e7\u00e3o", "is_in_staging": true, "is_partition": false, "type": "INTEGER", "mode": "NULLABLE"}, {"name": "id_comarca", "description": "ID Sede Comarca", "is_in_staging": true, "is_partition": false, "type": "INTEGER", "mode": "NULLABLE"}, {"name": "id_regiao_saude", "description": "ID Regi\u00e3o de Sa\u00fade", "is_in_staging": true, "is_partition": false, "type": "INTEGER", "mode": "NULLABLE"}, {"name": "regiao_saude", "description": "Regi\u00e3o de Sa\u00fade", "is_in_staging": true, "is_partition": false, "type": "STRING", "mode": "NULLABLE"}, {"name": "id_regiao_imediata", "description": "ID Regi\u00e3o Imediata - IBGE", "is_in_staging": true, "is_partition": false, "type": "INTEGER", "mode": "NULLABLE"}, {"name": "regiao_imediata", "description": "Regi\u00e3o Imediata", "is_in_staging": true, "is_partition": false, "type": "STRING", "mode": "NULLABLE"}, {"name": "id_regiao_intermediaria", "description": "ID Regi\u00e3o Intermedi\u00e1ria - IBGE", "is_in_staging": true, "is_partition": false, "type": "INTEGER", "mode": "NULLABLE"}, {"name": "regiao_intermediaria", "description": "Regi\u00e3o Intermedi\u00e1ria", "is_in_staging": true, "is_partition": false, "type": "STRING", "mode": "NULLABLE"}, {"name": "id_microrregiao", "description": "ID Microrregi\u00e3o - IBGE", "is_in_staging": true, "is_partition": false, "type": "INTEGER", "mode": "NULLABLE"}, {"name": "microrregiao", "description": "Microrregi\u00e3o", "is_in_staging": true, "is_partition": false, "type": "STRING", "mode": "NULLABLE"}, {"name": "id_mesorregiao", "description": "ID Mesorregi\u00e3o - IBGE", "is_in_staging": true, "is_partition": false, "type": "INTEGER", "mode": "NULLABLE"}, {"name": "mesorregiao", "description": "Mesorregi\u00e3o", "is_in_staging": true, "is_partition": false, "type": "STRING", "mode": "NULLABLE"}, {"name": "id_uf", "description": "<descri\u00e7\u00e3o da coluna>", "is_in_staging": true, "is_partition": false, "type": "INTEGER", "mode": "NULLABLE"}, {"name": "sigla_uf", "description": "Sigla Unidade da Federa\u00e7\u00e3o", "is_in_staging": true, "is_partition": false, "type": "STRING", "mode": "NULLABLE"}, {"name": "uf", "description": "Unidade da Federa\u00e7\u00e3o", "is_in_staging": true, "is_partition": false, "type": "STRING", "mode": "NULLABLE"}, {"name": "regiao", "description": "Regi\u00e3o", "is_in_staging": true, "is_partition": false, "type": "STRING", "mode": "NULLABLE"}, {"name": "existia_1991", "description": "Existia em 1991", "is_in_staging": true, "is_partition": false, "type": "INTEGER", "mode": "NULLABLE"}, {"name": "existia_2000", "description": "Existia em 2000", "is_in_staging": true, "is_partition": false, "type": "INTEGER", "mode": "NULLABLE"}, {"name": "existia_2010", "description": "Existia em 2010", "is_in_staging": true, "is_partition": false, "type": "INTEGER", "mode": "NULLABLE"}]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"name": "id_municipio", "description": "ID Munic\u00edpio - IBGE 7 D\u00edgitos", "is_in_staging": true, "is_partition": false, "type": "STRING"}, {"name": "id_municipio_6", "description": "ID Munic\u00edpio - IBGE 6 D\u00edgitos", "is_in_staging": true, "is_partition": false, "type": "STRING"}, {"name": "id_municipio_tse", "description": "ID Munic\u00edpio - TSE", "is_in_staging": true, "is_partition": false, "type": "STRING"}, {"name": "id_municipio_rf", "description": "ID Munic\u00edpio - Receita Federal", "is_in_staging": true, "is_partition": false, "type": "STRING"}, {"name": "id_municipio_bcb", "description": "ID Munic\u00edpio - Banco Central do Brasil", "is_in_staging": true, "is_partition": false, "type": "STRING"}, {"name": "municipio", "description": "Nome Munic\u00edpio", "is_in_staging": true, "is_partition": false, "type": "STRING"}, {"name": "capital_uf", "description": "Capital da Unidade da Federa\u00e7\u00e3o", "is_in_staging": true, "is_partition": false, "type": "STRING"}, {"name": "id_comarca", "description": "ID Sede Comarca", "is_in_staging": true, "is_partition": false, "type": "STRING"}, {"name": "id_regiao_saude", "description": "ID Regi\u00e3o de Sa\u00fade", "is_in_staging": true, "is_partition": false, "type": "STRING"}, {"name": "regiao_saude", "description": "Regi\u00e3o de Sa\u00fade", "is_in_staging": true, "is_partition": false, "type": "STRING"}, {"name": "id_regiao_imediata", "description": "ID Regi\u00e3o Imediata - IBGE", "is_in_staging": true, "is_partition": false, "type": "STRING"}, {"name": "regiao_imediata", "description": "Regi\u00e3o Imediata", "is_in_staging": true, "is_partition": false, "type": "STRING"}, {"name": "id_regiao_intermediaria", "description": "ID Regi\u00e3o Intermedi\u00e1ria - IBGE", "is_in_staging": true, "is_partition": false, "type": "STRING"}, {"name": "regiao_intermediaria", "description": "Regi\u00e3o Intermedi\u00e1ria", "is_in_staging": true, "is_partition": false, "type": "STRING"}, {"name": "id_microrregiao", "description": "ID Microrregi\u00e3o - IBGE", "is_in_staging": true, "is_partition": false, "type": "STRING"}, {"name": "microrregiao", "description": "Microrregi\u00e3o", "is_in_staging": true, "is_partition": false, "type": "STRING"}, {"name": "id_mesorregiao", "description": "ID Mesorregi\u00e3o - IBGE", "is_in_staging": true, "is_partition": false, "type": "STRING"}, {"name": "mesorregiao", "description": "Mesorregi\u00e3o", "is_in_staging": true, "is_partition": false, "type": "STRING"}, {"name": "id_uf", "description": "<descri\u00e7\u00e3o da coluna>", "is_in_staging": true, "is_partition": false, "type": "STRING"}, {"name": "sigla_uf", "description": "Sigla Unidade da Federa\u00e7\u00e3o", "is_in_staging": true, "is_partition": false, "type": "STRING"}, {"name": "uf", "description": "Unidade da Federa\u00e7\u00e3o", "is_in_staging": true, "is_partition": false, "type": "STRING"}, {"name": "regiao", "description": "Regi\u00e3o", "is_in_staging": true, "is_partition": false, "type": "STRING"}, {"name": "existia_1991", "description": "Existia em 1991", "is_in_staging": true, "is_partition": false, "type": "STRING"}, {"name": "existia_2000", "description": "Existia em 2000", "is_in_staging": true, "is_partition": false, "type": "STRING"}, {"name": "existia_2010", "description": "Existia em 2010", "is_in_staging": true, "is_partition": false, "type": "STRING"}]
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
table_id: municipios # AUTO GENERATED
dataset_id: br_basedosdados_diretorios_brasil # AUTO GENERATED
table_id: municipio # AUTO GENERATED
dataset_id: br_bd_diretorios_brasil # AUTO GENERATED

last_updated: 2020-10-09 # AUTO GENERATED
last_updated: 2020-11-21 # AUTO GENERATED

# Descreva a tabela. Essas são as primeiras frases que um usuário vai ver.
# Você não precisa ser muito conciso. Sinta-se a vontade para dar exemplos de
Expand Down Expand Up @@ -73,7 +73,7 @@ partitions: # REQUIRED
# Para esses, defina is_in_staging como False.
# Além disso, você deve adicionar as colunas de partição aqui e definir is_partition como True.
columns: # REQUIRED

-
name: id_municipio
description: ID Município - IBGE 7 Dígitos
Expand All @@ -87,19 +87,19 @@ columns: # REQUIRED
is_partition: False # Bool [True, False], whether the column is a partition.

-
name: id_municipio_TSE
name: id_municipio_tse
description: ID Município - TSE
is_in_staging: True # Bool [True, False], whether the column is in the staging table
is_partition: False # Bool [True, False], whether the column is a partition.

-
name: id_municipio_RF
name: id_municipio_rf
description: ID Município - Receita Federal
is_in_staging: True # Bool [True, False], whether the column is in the staging table
is_partition: False # Bool [True, False], whether the column is a partition.

-
name: id_municipio_BCB
name: id_municipio_bcb
description: ID Município - Banco Central do Brasil
is_in_staging: True # Bool [True, False], whether the column is in the staging table
is_partition: False # Bool [True, False], whether the column is a partition.
Expand All @@ -111,8 +111,8 @@ columns: # REQUIRED
is_partition: False # Bool [True, False], whether the column is a partition.

-
name: capital_estado
description: Capital de Estado
name: capital_uf
description: Capital da Unidade da Federação
is_in_staging: True # Bool [True, False], whether the column is in the staging table
is_partition: False # Bool [True, False], whether the column is a partition.

Expand Down Expand Up @@ -160,7 +160,7 @@ columns: # REQUIRED

-
name: id_microrregiao
description: ID Microrregião
description: ID Microrregião - IBGE
is_in_staging: True # Bool [True, False], whether the column is in the staging table
is_partition: False # Bool [True, False], whether the column is a partition.

Expand All @@ -183,20 +183,21 @@ columns: # REQUIRED
is_partition: False # Bool [True, False], whether the column is a partition.

-
name: id_estado
description: ID Estado - IBGE
name: id_uf
description: ID Unidade da Federação - IBGE
description: <descrição da coluna>
is_in_staging: True # Bool [True, False], whether the column is in the staging table
is_partition: False # Bool [True, False], whether the column is a partition.

-
name: estado_abrev
description: Estado Abreviado (UF)
name: sigla_uf
description: Sigla Unidade da Federação
is_in_staging: True # Bool [True, False], whether the column is in the staging table
is_partition: False # Bool [True, False], whether the column is a partition.

-
name: estado
description: Estado
name: uf
description: Unidade da Federação
is_in_staging: True # Bool [True, False], whether the column is in the staging table
is_partition: False # Bool [True, False], whether the column is a partition.

Expand All @@ -208,18 +209,18 @@ columns: # REQUIRED

-
name: existia_1991
description: Município Existia em 1991
description: Existia em 1991
is_in_staging: True # Bool [True, False], whether the column is in the staging table
is_partition: False # Bool [True, False], whether the column is a partition.

-
name: existia_2000
description: Município Existia em 2000
description: Existia em 2000
is_in_staging: True # Bool [True, False], whether the column is in the staging table
is_partition: False # Bool [True, False], whether the column is a partition.

-
name: existia_2010
description: Município Existia em 2010
description: Existia em 2010
is_in_staging: True # Bool [True, False], whether the column is in the staging table
is_partition: False # Bool [True, False], whether the column is a partition.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ TIPOS:
- Mais detalhes: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types
*/
CREATE VIEW basedosdados.br_basedosdados_diretorios_brasil.estados AS

CREATE VIEW basedosdados.br_bd_diretorios_brasil.uf AS
SELECT
SAFE_CAST(id_estado AS INT64) id_estado,
SAFE_CAST(estado_abrev AS STRING) estado_abrev,
SAFE_CAST(estado AS STRING) estado,
SAFE_CAST(id_uf AS INT64) id_uf,
SAFE_CAST(sigla_uf AS STRING) sigla_uf,
SAFE_CAST(uf AS STRING) uf,
SAFE_CAST(regiao AS STRING) regiao
from basedosdados-staging.br_basedosdados_diretorios_brasil_staging.estados as t
from basedosdados-staging.br_bd_diretorios_brasil_staging.uf as t
Loading

0 comments on commit 8e72964

Please sign in to comment.