Skip to content

Commit 0c9bc0c

Browse files
committed
process_tracker_python-1 Add support for other relational databases
🐛 MySQL extracts return out of order Two tests around returning extracts in specific orders are failing with MySQL. Trying to resolve. Working on #1
1 parent 584480e commit 0c9bc0c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

process_tracker/process_tracker.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ def find_ready_extracts_by_filename(self, filename):
117117
.join(ExtractStatus)\
118118
.filter(Extract.extract_filename.like("%" + filename + "%"))\
119119
.filter(ExtractStatus.extract_status_name == 'ready') \
120-
.order_by(Extract.extract_registration_date_time)
120+
.order_by(Extract.extract_registration_date_time)\
121+
.order_by(Extract.extract_id)
121122

122123
for record in process_files:
123124
extract_files.append(join(record.location_path, record.extract_filename))

tests/test_process_tracker.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ def test_find_ready_extracts_by_filename_full(self):
134134

135135
def test_find_ready_extracts_by_filename_partial(self):
136136
"""
137-
Testing that for the given partial filename, find the extracts, provided they are in 'ready' state.
137+
Testing that for the given partial filename, find the extracts, provided they are in 'ready' state. Should return in
138+
Ascending order.
138139
:return:
139140
"""
140141
extract = ExtractTracker(process_run=self.process_tracker
@@ -153,7 +154,6 @@ def test_find_ready_extracts_by_filename_partial(self):
153154
session.commit()
154155

155156
extract2.extract.extract_status_id = extract2.extract_status_ready
156-
extract2.extract_registration_date_time = self.timestamp_converter(timestamp=datetime.now()) + timedelta(hours=1)
157157
session = Session.object_session(extract2.extract)
158158
session.commit()
159159

@@ -186,7 +186,6 @@ def test_find_ready_extracts_by_filename_partial_not_descending(self):
186186
session.commit()
187187

188188
extract2.extract.extract_status_id = extract2.extract_status_ready
189-
extract2.extract_registration_date_time = self.timestamp_converter(timestamp=datetime.now()) + timedelta(hours=1)
190189
session = Session.object_session(extract2.extract)
191190
session.commit()
192191

0 commit comments

Comments
 (0)