Skip to content

Commit

Permalink
revision data team
Browse files Browse the repository at this point in the history
  • Loading branch information
tricktx committed Sep 28, 2023
1 parent 81e8430 commit 1c1d778
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions pipelines/datasets/br_stf_corte_aberta/schedules.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
Schedules for br_stf_corte_aberta
"""

from datetime import datetime, timedelta
from datetime import datetime

from prefect.schedules import Schedule
from prefect.schedules.clocks import IntervalClock
from prefect.schedules.clocks import CronClock

from pipelines.constants import constants

every_day_stf = Schedule(
clocks=[
IntervalClock(
interval=timedelta(weeks=2),
CronClock(
cron="0 12 * * *", # Irá rodar todos os dias meio dia
start_date=datetime(2021, 1, 1),
labels=[
constants.BASEDOSDADOS_DEV_AGENT_LABEL.value,
constants.BASEDOSDADOS_PROD_AGENT_LABEL.value,
],
parameter_defaults={
"dataset_id": "br_stf_corte_aberta",
"table_id": "decisoes",
"materialization_mode": "dev",
"materialization_mode": "prod",
"materialize_after_dump": True,
"dbt_alias": True,
"update_metadata": True,
Expand Down
4 changes: 2 additions & 2 deletions pipelines/datasets/br_stf_corte_aberta/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ def check_for_updates(dataset_id, table_id):
dataset_id=dataset_id,
table_id=table_id,
date_format="yy-mm-dd",
billing_project_id="basedosdados-dev",
billing_project_id="basedosdados",
data="data_decisao",
)
# Registra a data mais recente do site
log(f"Última data no site do STF: {data_obj}")
log(f"Última data no site da BD: {data_bq_obj}")
# Compara as datas para verificar se há atualizações
if data_obj == data_bq_obj:
if data_obj > data_bq_obj:
return True # Há atualizações disponíveis
else:
return False # Não há novas atualizações disponíveis
Expand Down

0 comments on commit 1c1d778

Please sign in to comment.