Skip to content

Commit

Permalink
Merge pull request #122 from basedosdados/staging/br_me_caged
Browse files Browse the repository at this point in the history
[dbt] br_me_caged
  • Loading branch information
gabrielle-carv authored Jul 24, 2023
2 parents 2859689 + 0b1a307 commit 6ebff84
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
8 changes: 5 additions & 3 deletions models/br_me_caged/microdados_movimentacao.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
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(a.sigla_uf AS STRING) sigla_uf,
SAFE_CAST(b.id_municipio AS STRING) id_municipio,
SAFE_CAST(cnae_2_secao AS STRING) cnae_2_secao,
SAFE_CAST(cnae_2_subclasse AS STRING) cnae_2_subclasse,
SAFE_CAST(saldo_movimentacao AS INT64) saldo_movimentacao,
Expand All @@ -39,4 +39,6 @@ SAFE_CAST(tamanho_estabelecimento_janeiro AS STRING) tamanho_estabelecimento_jan
SAFE_CAST(indicador_aprendiz AS STRING) indicador_aprendiz,
SAFE_CAST(origem_informacao AS STRING) origem_informacao,
SAFE_CAST(indicador_fora_prazo AS INT64) indicador_fora_prazo
FROM basedosdados-staging.br_me_caged_staging.microdados_movimentacao AS t
FROM `basedosdados-staging.br_me_caged_staging.microdados_movimentacao` a
LEFT JOIN `basedosdados.br_bd_diretorios_brasil.municipio` b
ON a.id_municipio = b.id_municipio_6
8 changes: 5 additions & 3 deletions models/br_me_caged/microdados_movimentacao_excluida.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
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(a.sigla_uf AS STRING) sigla_uf,
SAFE_CAST(b.id_municipio AS STRING) id_municipio,
SAFE_CAST(cnae_2_secao AS STRING) cnae_2_secao,
SAFE_CAST(cnae_2_subclasse AS STRING) cnae_2_subclasse,
SAFE_CAST(saldo_movimentacao AS INT64) saldo_movimentacao,
Expand All @@ -40,4 +40,6 @@ SAFE_CAST(indicador_aprendiz AS STRING) indicador_aprendiz,
SAFE_CAST(origem_informacao AS STRING) origem_informacao,
SAFE_CAST(indicador_exclusao AS INT64) indicador_exclusao,
SAFE_CAST(indicador_fora_prazo AS INT64) indicador_fora_prazo
FROM basedosdados-staging.br_me_caged_staging.microdados_movimentacao_excluida AS t
FROM `basedosdados-staging.br_me_caged_staging.microdados_movimentacao_excluida` a
LEFT JOIN `basedosdados.br_bd_diretorios_brasil.municipio` b
ON a.id_municipio = b.id_municipio_6
8 changes: 5 additions & 3 deletions models/br_me_caged/microdados_movimentacao_fora_prazo.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
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(a.sigla_uf AS STRING) sigla_uf,
SAFE_CAST(b.id_municipio AS STRING) id_municipio,
SAFE_CAST(cnae_2_secao AS STRING) cnae_2_secao,
SAFE_CAST(cnae_2_subclasse AS STRING) cnae_2_subclasse,
SAFE_CAST(saldo_movimentacao AS INT64) saldo_movimentacao,
Expand All @@ -39,4 +39,6 @@ SAFE_CAST(tamanho_estabelecimento_janeiro AS STRING) tamanho_estabelecimento_jan
SAFE_CAST(indicador_aprendiz AS STRING) indicador_aprendiz,
SAFE_CAST(origem_informacao AS STRING) origem_informacao,
SAFE_CAST(indicador_fora_prazo AS INT64) indicador_fora_prazo
FROM basedosdados-staging.br_me_caged_staging.microdados_movimentacao_fora_prazo AS t
FROM `basedosdados-staging.br_me_caged_staging.microdados_movimentacao_fora_prazo` a
LEFT JOIN `basedosdados.br_bd_diretorios_brasil.municipio` b
ON a.id_municipio = b.id_municipio_6

0 comments on commit 6ebff84

Please sign in to comment.