Skip to content

Commit 6225054

Browse files
update to using a constant
1 parent eae99a8 commit 6225054

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

apps/bfd-pipeline-idr/src/idr_pipeline/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,3 +255,5 @@
255255
# Need to declare this separately because python struggles
256256
# with type-hinting empty arrays :(
257257
EMPTY_PARTITION: list[LoadPartitionGroup] = []
258+
259+
DEFAULT_JOB_ID = 1

apps/bfd-pipeline-idr/src/idr_pipeline/model/load_progress.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from ..load_partition import LoadPartition
55
from ..model.base_model import IdrBaseModel, ModelType, Source
6+
from ..constants import DEFAULT_JOB_ID
67

78

89
class LoadProgress(IdrBaseModel):
@@ -37,14 +38,7 @@ def model_type() -> ModelType:
3738
@override
3839
@classmethod
3940
def fetch_query(cls, partition: LoadPartition, start_time: datetime, source: Source) -> str:
40-
return f"""
41-
SELECT table_name, last_ts, last_id, batch_partition, job_start_ts,
42-
batch_complete_ts, job_id, max_run_ts
43-
FROM idr.load_progress
44-
WHERE table_name = %({LoadProgress.query_placeholder()})s
45-
AND batch_partition = '{partition.name}'
46-
AND job_id = 1
47-
"""
41+
return cls.fetch_query_by_job(partition, DEFAULT_JOB_ID)
4842

4943
@classmethod
5044
def fetch_query_by_job(cls, partition: LoadPartition, job_id: int) -> str:

0 commit comments

Comments
 (0)