Skip to content

Commit

Permalink
Merge branch 'main' into staging/add_gtfs_validator
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Sep 5, 2024
2 parents 6b49f9f + 2c7caef commit 3006279
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 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-09-04
DBT: 2024-09-05
"""

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

## [2.4.0] - 2024-09-05

### Alterado
- Adiciona coluna `hash_cliente` no modelo `transacao.sql` (https://github.com/prefeitura-rio/pipelines_rj_smtr/pull/189)

## [2.3.0] - 2024-08-26

### Adicionado
Expand Down
6 changes: 5 additions & 1 deletion queries/models/br_rj_riodejaneiro_bilhetagem/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ models:
- name: id_validador
description: "{{ doc('id_validador') }}"
- name: id_cliente
description: "Identificador único do cliente"
description: "Identificador único do cliente [protegido]"
policy_tags:
- 'projects/rj-smtr/locations/us/taxonomies/6071707853840412174/policyTags/1168584191451386864'
- name: hash_cliente
description: "Hash identificador do cliente [protegido]"
policy_tags:
- 'projects/rj-smtr/locations/us/taxonomies/6071707853840412174/policyTags/1168584191451386864'
- name: id_transacao
Expand Down
9 changes: 9 additions & 0 deletions queries/models/br_rj_riodejaneiro_bilhetagem/transacao.sql
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ WITH transacao AS (
*
FROM
{{ transacao_staging }}
-- `rj-smtr.br_rj_riodejaneiro_bilhetagem_staging.transacao`
{% if is_incremental() %}
WHERE
{{ incremental_filter }}
Expand All @@ -91,6 +92,7 @@ gratuidade AS (
data_fim_validade
FROM
{{ ref("gratuidade_aux") }}
-- `rj-smtr.br_rj_riodejaneiro_bilhetagem_staging.gratuidade_aux`
-- TODO: FILTRAR PARTIÇÕES DE FORMA EFICIENTE
),
tipo_pagamento AS (
Expand All @@ -110,6 +112,7 @@ integracao AS (
datetime_processamento_integracao
FROM
{{ ref("integracao") }}
-- `rj-smtr.br_rj_riodejaneiro_bilhetagem.integracao`
{% if is_incremental() %}
WHERE
{% if transacao_partition_list|length > 0 %}
Expand Down Expand Up @@ -160,18 +163,22 @@ new_data AS (
transacao AS t
LEFT JOIN
{{ source("cadastro", "modos") }} m
-- `rj-smtr.cadastro.modos` m
ON
t.id_tipo_modal = m.id_modo AND m.fonte = "jae"
LEFT JOIN
{{ ref("operadoras") }} do
-- `rj-smtr.cadastro.operadoras` do
ON
t.cd_operadora = do.id_operadora_jae
LEFT JOIN
{{ ref("consorcios") }} dc
-- `rj-smtr.cadastro.consorcios` dc
ON
t.cd_consorcio = dc.id_consorcio_jae
LEFT JOIN
{{ ref("staging_linha") }} l
-- `rj-smtr.br_rj_riodejaneiro_bilhetagem_staging.linha` l
ON
t.cd_linha = l.cd_linha
-- LEFT JOIN
Expand All @@ -195,6 +202,7 @@ new_data AS (
AND (t.data_transacao < g.data_fim_validade OR g.data_fim_validade IS NULL)
LEFT JOIN
{{ ref("staging_linha_sem_ressarcimento") }} lsr
-- `rj-smtr.br_rj_riodejaneiro_bilhetagem_staging.linha_sem_ressarcimento` lsr
ON
t.cd_linha = lsr.id_linha
WHERE
Expand Down Expand Up @@ -314,6 +322,7 @@ SELECT
t.id_veiculo,
t.id_validador,
t.id_cliente,
SHA256(t.id_cliente) AS hash_cliente,
t.id_transacao,
t.tipo_pagamento,
t.tipo_transacao,
Expand Down

0 comments on commit 3006279

Please sign in to comment.