Skip to content

Commit

Permalink
Merge branch 'main' into staging/add_cd_docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Aug 20, 2024
2 parents 4327425 + 44e0a03 commit ad5785d
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 ad5785d

Please sign in to comment.