Skip to content

Commit

Permalink
Merge branch 'master' into staging/br_mercadolivre_ofertas.vendedor
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielle-carv authored Jul 25, 2023
2 parents b7b2ffa + 7fef8e4 commit c29a8ce
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 2 deletions.
3 changes: 3 additions & 0 deletions dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ models:
+post-hook:
- 'REVOKE `roles/bigquery.dataViewer` ON TABLE {{ this }} FROM "specialGroup:allUsers"'
- 'GRANT `roles/bigquery.dataViewer` ON TABLE {{ this }} TO "group:bd-pro@basedosdados.org"'
br_bcb_agencia:
+materialized: table
+schema: br_bcb_agencia
br_bcb_estban:
+materialized: table
+schema: br_bcb_estban
Expand Down
6 changes: 5 additions & 1 deletion models/br_bcb_agencia/br_bcb_agencia__agencia.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{{ config(alias = 'agencia', schema = 'br_bcb_agencia')}}
{{ config(
alias = 'agencia',
schema = 'br_bcb_agencia')
}}

SELECT
SAFE_CAST(ano AS INT64) ano,
Expand All @@ -20,3 +23,4 @@ SAFE_CAST(ddd AS STRING) ddd,
SAFE_CAST(fone AS STRING) fone,
SAFE_CAST(id_instalacao AS STRING) id_instalacao
FROM basedosdados-staging.br_bcb_agencia_staging.agencia AS t
WHERE DATE(CAST(ano AS INT64),CAST(mes AS INT64),1)<= DATE(2023,2,1)
30 changes: 30 additions & 0 deletions models/br_bcb_agencia/br_bcb_agencia__agencia_atualizado.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{ config(
alias = 'agencia_atualizado',
schema = 'br_bcb_agencia',
post_hook=[
'REVOKE `roles/bigquery.dataViewer` ON TABLE {{ this }} FROM "specialGroup:allUsers"',
'GRANT `roles/bigquery.dataViewer` ON TABLE {{ this }} TO "group:bd-pro@basedosdados.org"'])
}}



SELECT
SAFE_CAST(ano AS INT64) ano,
SAFE_CAST(mes AS INT64) mes,
SAFE_CAST(sigla_uf AS STRING) sigla_uf,
SAFE_CAST(id_municipio AS STRING) id_municipio,
SAFE_CAST(data_inicio AS DATE) data_inicio,
SAFE_CAST(cnpj AS STRING) cnpj,
SAFE_CAST(nome_agencia AS STRING) nome_agencia,
SAFE_CAST(instituicao AS STRING) instituicao,
SAFE_CAST(segmento AS STRING) segmento,
SAFE_CAST(id_compe_bcb_agencia AS STRING) id_compe_bcb_agencia,
SAFE_CAST(id_compe_bcb_instituicao AS STRING) id_compe_bcb_instituicao,
SAFE_CAST(cep AS STRING) cep,
SAFE_CAST(endereco AS STRING) endereco,
SAFE_CAST(complemento AS STRING) complemento,
SAFE_CAST(bairro AS STRING) bairro,
SAFE_CAST(ddd AS STRING) ddd,
SAFE_CAST(fone AS STRING) fone,
SAFE_CAST(id_instalacao AS STRING) id_instalacao
FROM basedosdados-staging.br_bcb_agencia_staging.agencia AS t
44 changes: 43 additions & 1 deletion models/br_bcb_agencia/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,46 @@ models:
- name: fone
description: "Fone"
- name: id_instalacao
description: "identificador de instalação da agência"
description: "identificador de instalação da agência"

- name: br_bcb_agencia__agencia_atualizado
description: "dbt model for agencia month table"
columns:
- name: ano
description: "Ano"
- name: mes
description: "Mês"
- name: sigla_uf
description: "Sigla da Unidade da Federação"
- name: id_municipio
description: "ID Município - IBGE 7 Dígitos"
- name: data_inicio
description: "Data de criação da agência"
- name: cnpj
description: "Cadastro Nacional de Pessoa Júridica (CNPJ)"
- name: nome_agencia
description: "Nome da Agência"
- name: instituicao
description: "Nome da Instituição Financeira (IF)"
- name: segmento
description: "Segemento de atuação da IF"
- name: id_compe_bcb_agencia
description: "Identificador do Sistema de Operações Monetárias e Compensações de Outros Papéis (COMPE) do Banco Central da agência"
- name: id_compe_bcb_instituicao
description: "Identificador do Sistema de Operações Monetárias e Compensações de Outros Papéis (COMPE) do Banco Central da instituição"
- name: nome_agencia
description: "Nome da Agência"
- name: cep
description: "CEP"
- name: endereco
description: "endereço da agência"
- name: complemento
description: "Complemento do endereço"
- name: bairro
description: "Bairro"
- name: ddd
description: "ddd"
- name: fone
description: "Fone"
- name: id_instalacao
description: "identificador de instalação da agência"

0 comments on commit c29a8ce

Please sign in to comment.