Skip to content
This repository was archived by the owner on Mar 13, 2020. It is now read-only.

Commit 4d134b8

Browse files
author
Sean Budd
authored
Print number of rows processed as an output of process command (#42)
1 parent 0f4a45d commit 4d134b8

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

rdl/DataLoadManager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def start_imports(self, force_full_refresh_models):
5858
model_number += 1 # avoid all_model_names.index(model_name) due to linear time-complexity in list length
5959
self.start_single_import(model_file, request_full_refresh, model_number, total_number_of_models)
6060

61-
self.data_load_tracker_repository.complete_execution(self.execution_id, total_number_of_models)
61+
return self.data_load_tracker_repository.complete_execution(self.execution_id, total_number_of_models)
6262

6363
def start_single_import(self, model_file, requested_full_refresh, model_number, total_number_of_models):
6464
model_name = model_file.stem

rdl/RelationalDataLoader.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ def execute_process_command(self):
3636
repository = DataLoadTrackerRepository(session_maker)
3737

3838
data_load_manager = DataLoadManager(self.args.configuration_folder, source_db, destination_db, repository)
39-
data_load_manager.start_imports(self.args.force_full_refresh_models)
39+
total_rows_processed = data_load_manager.start_imports(self.args.force_full_refresh_models)
40+
41+
print(total_rows_processed)
4042

4143
def execute_audit_command(self):
4244
destination_db = create_engine(self.args.destination_connection_string)

rdl/data_load_tracking/DataLoadTrackerRepository.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,17 @@ def complete_execution(self, execution_id, total_number_of_models,
4343

4444
execution_end_time = session.query(func.now()).scalar()
4545
total_execution_seconds = (execution_end_time - current_execution.execution_started).total_seconds()
46+
total_rows_processed = self.get_execution_rows(current_execution.id)
4647

4748
current_execution.total_models_processed = total_number_of_models
4849
current_execution.status = status
4950
current_execution.execution_ended = execution_end_time
5051
current_execution.execution_time_s = total_execution_seconds
51-
current_execution.total_rows_processed = self.get_execution_rows(current_execution.id)
52+
current_execution.total_rows_processed = total_rows_processed
5253
session.commit()
5354
self.logger.info(current_execution)
5455
session.close()
56+
return total_rows_processed
5557

5658
def create_execution_model(self, data_load_tracker):
5759
new_execution_model = ExecutionModelEntity(

0 commit comments

Comments
 (0)