From 63ec84e9b28e92c763a267e0d1c542fe39276f55 Mon Sep 17 00:00:00 2001 From: Mateusz Konieczny Date: Tue, 8 Nov 2022 23:13:02 +0100 Subject: [PATCH] handle dates in passed data on reporting errors json.dumps fails on date objects --- .../obtain_livestream_data_and_load_into_database.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/etl/planning_data/obtain_livestream_data_and_load_into_database.py b/etl/planning_data/obtain_livestream_data_and_load_into_database.py index bd663dea..3796f2ea 100644 --- a/etl/planning_data/obtain_livestream_data_and_load_into_database.py +++ b/etl/planning_data/obtain_livestream_data_and_load_into_database.py @@ -90,7 +90,7 @@ def load_data_into_database(cursor, data): print() print(e) print() - print(json.dumps(entry, indent = 4)) + show_dictionary(entry) raise e def date_in_future(date): @@ -175,6 +175,10 @@ def insert_entry(cursor, e): e["uprn"]) ) +def show_dictionary(data): + for key in data.keys(): + print(key, "=", data[key]) + def days_since(date, now): if(date == None): return None