Skip to content

Commit

Permalink
Hotfix - Corrige modelos sppo_aux_registros_filtrada e sppo_aux_regis…
Browse files Browse the repository at this point in the history
…tros_realocacao (#152)

* add schedule every_15_minute

* cria flow gps 15 min

* altera label schedule

* remove parametro

* altera GPS_SPPO_15_MIN_TREATED_TABLE_ID

* add data dbt

* cria modelo gps_sppo_15_minutos

* altera para prod

* add changelogs

* altera materialized e filtros

* teste var fifteen_minutes

* corrige _vars

* altera para dev

* altera materialized

* altera condições where

* corrige refs

* altera refs

* altera materialized

* volta materialized para view

* altera schedule do flow recaptura_15min

* adiciona truncate_minutes

* altera materialized para ephemeral

* altera para prod

* altera default parameters de materialize_gps_15_min

* altera default parameters de materialize_gps_15_min

* add changelog

* corrige digitação

* corrige filtros dos modelos sppo_aux_registros_filtrada e sppo_aux_registros_realocacao

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
akaBotelho and mergify[bot] authored Aug 20, 2024
1 parent f5c77fc commit 44e0a03
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pipelines/migration/br_rj_riodejaneiro_onibus_gps/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""
Flows for br_rj_riodejaneiro_onibus_gps
DBT: 2024-08-16
DBT: 2024-08-20
"""

from copy import deepcopy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ gps AS (
ST_GEOGPOINT(longitude, latitude) posicao_veiculo_geo
FROM
{{ ref('sppo_registros') }}
{% if is_incremental() -%}
WHERE
data between DATE("{{var('date_range_start')}}") and DATE("{{var('date_range_end')}}")
AND timestamp_gps > "{{var('date_range_start')}}" and timestamp_gps <="{{var('date_range_end')}}"
{%- endif -%}
),
realocacao as (
SELECT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ with realocacao as (
where
-- Realocação deve acontecer após o registro de GPS e até 1 hora depois
datetime_diff(datetime_operacao, datetime_entrada, minute) between 0 and 60
{% if is_incremental() -%}
and data between DATE("{{var('date_range_start')}}")
and DATE(datetime_add("{{var('date_range_end')}}", interval 1 hour))
and datetime_operacao between datetime("{{var('date_range_start')}}")
and datetime_add("{{var('date_range_end')}}", interval 1 hour)
{%- endif -%}
),
-- 2. Altera registros de GPS com servicos realocados
gps as (
Expand Down

0 comments on commit 44e0a03

Please sign in to comment.