Skip to content

Commit

Permalink
Merge branch 'main' into staging/apuracao-faixa-horaria-subsidio
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Sep 4, 2024
2 parents 0ec1eca + 81f7704 commit 6534e5f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pipelines/migration/br_rj_riodejaneiro_bilhetagem/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""
Flows for br_rj_riodejaneiro_bilhetagem
DBT: 2024-08-26
DBT: 2024-09-04
"""

from copy import deepcopy
Expand Down
7 changes: 7 additions & 0 deletions queries/models/validacao_dados_jae/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog - validacao_dados_jae

## [1.1.3] - 2024-09-04

### Alterado
- Modelo `integracao_nao_realizada.sql`:
- Soma 1 na coluna `sequencia_integracao` para padronizar em relação a tabela `integracao` (https://github.com/prefeitura-rio/pipelines_rj_smtr/pull/185)
- Cria filtro para remover integrações com 2 ou mais transações do modo `BRT` (https://github.com/prefeitura-rio/pipelines_rj_smtr/pull/185)

## [1.1.2] - 2024-08-27

### Corrigido
Expand Down
12 changes: 7 additions & 5 deletions queries/models/validacao_dados_jae/integracao_nao_realizada.sql
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

WITH matriz AS (
SELECT
string_agg(modo order by sequencia_integracao) AS sequencia_valida
STRING_AGG(modo order by sequencia_integracao) AS sequencia_valida
FROM
{{ ref("matriz_integracao") }}
-- `rj-smtr.br_rj_riodejaneiro_bilhetagem.matriz_integracao`
Expand Down Expand Up @@ -206,7 +206,8 @@ melted AS (
id_transacao,
modo,
SPLIT(servico_sentido, '_')[0] AS id_servico_jae,
SPLIT(servico_sentido, '_')[1] AS sentido
SPLIT(servico_sentido, '_')[1] AS sentido,
COUNTIF(modo = "BRT") OVER(PARTITION BY id_integracao) > 1 AS indicador_transferencia
FROM
integracoes_validas,
UNNEST(
Expand All @@ -216,7 +217,7 @@ melted AS (
{% for column in pivot_columns %}
{{ column }}_{{ transaction_number }} AS {{ column }},
{% endfor %}
{{ transaction_number }} AS sequencia_integracao
{{ transaction_number + 1}} AS sequencia_integracao
){%if not loop.last %},{% endif %}
{% endfor %}
]
Expand All @@ -228,7 +229,8 @@ integracao_nao_realizada AS (
FROM
melted
WHERE
id_transacao NOT IN (
NOT indicador_transferencia
AND id_transacao NOT IN (
SELECT
id_transacao
FROM
Expand All @@ -241,7 +243,7 @@ integracao_nao_realizada AS (
)
)
SELECT
*,
* EXCEPT(indicador_transferencia),
'{{ var("version") }}' as versao
FROM
melted
Expand Down

0 comments on commit 6534e5f

Please sign in to comment.