Skip to content

Commit

Permalink
[dmap-import] FEAT: Log error when DMAP API file contains no records (#…
Browse files Browse the repository at this point in the history
…32)

The change logs an Error/Exception if dmap-import API download contains no records.

Asana Task: https://app.asana.com/0/1203883924584572/1208782928208814
  • Loading branch information
rymarczy authored Nov 19, 2024
1 parent 974ead5 commit 32448bc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/cubic_loader/dmap/api_copy_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,18 @@ def run_api_copy(url: str, destination_table: Any) -> None:

update_api_metadata_table(url, result, db_manager)

api_result_log.log_complete(
api_result_log.add_metadata(
db_records_deleted=delete_result.rowcount,
db_records_added=update_result.rowcount,
)

if update_result.rowcount > 0:
api_result_log.log_complete()
else:
api_result_log.log_failure(
exception=AssertionError(f"dataset_id: {result["dataset_id"]} contains no records.")
)

except Exception as exception:
api_result_log.log_failure(exception)
raise exception
Expand Down

0 comments on commit 32448bc

Please sign in to comment.