From cc8e7eb87b4fd56dff784334e3b0008eb2c11dd0 Mon Sep 17 00:00:00 2001 From: Alejandro Villar Date: Wed, 10 May 2023 10:28:19 +0200 Subject: [PATCH] Add debugging info for transforms --- ogc/na/ingest_json.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ogc/na/ingest_json.py b/ogc/na/ingest_json.py index 9659bb3..b8ae57c 100644 --- a/ogc/na/ingest_json.py +++ b/ogc/na/ingest_json.py @@ -245,8 +245,11 @@ def uplift_json(data: dict | list, context: dict, # Allow for transform lists to do sequential transformations if isinstance(transform, str): transform = (transform,) - for t in transform: - data_graph = json.loads(jq.compile(t).input(data_graph).text()) + for i, t in enumerate(transform): + tranformed_txt = jq.compile(t).input(data_graph).text() + if logger.isEnabledFor(logging.DEBUG): + logger.debug('After transform %d:\n%s', i + 1, tranformed_txt) + data_graph = json.loads(tranformed_txt) # Add types types = context.get('types', {})