Skip to content

Commit

Permalink
Merge pull request #519 from basedosdados/fix-camara
Browse files Browse the repository at this point in the history
[dbt] fix tables proposicao
  • Loading branch information
tricktx authored Mar 25, 2024
2 parents 8b6cfdc + c8d93e4 commit e7ff52f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{ config(alias="proposicao_autor", schema="br_camara_dados_abertos") }}

select
select distinct
safe_cast(idproposicao as string) id_proposicao,
replace(safe_cast(iddeputadoautor as string), ".0", "") id_deputado,
initcap(safe_cast(tipoautor as string)) tipo_autor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,6 @@ with
url_ultimo_status,
from table
)
select *
select distinct *
from query_total
where not (ano = 2011 and id_proposicao = '510035')
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@
)
}}

select
safe_cast(replace(ano, ".0", "") as int64) ano,
regexp_extract(uriproposicao, r'/proposicoes/(\d+)') as id_proposicao,
safe_cast(siglatipo as string) tipo_proposicao,
safe_cast(numero as string) numero,
safe_cast(codtema as string) tema,
safe_cast(relevancia as int64) relevancia,
from `basedosdados-staging.br_camara_dados_abertos_staging.proposicao_tema` as t
with
tables as (
select
safe_cast(replace(ano, ".0", "") as int64) as ano,
regexp_extract(uriproposicao, r'/proposicoes/(\d+)') as id_proposicao,
safe_cast(siglatipo as string) as tipo_proposicao,
safe_cast(numero as string) as numero,
safe_cast(tema as string) as tema,
safe_cast(relevancia as int64) as relevancia
from `basedosdados-staging.br_camara_dados_abertos_staging.proposicao_tema`
)
select *
from tables
where not (ano = 2011 and id_proposicao = '510035')

0 comments on commit e7ff52f

Please sign in to comment.